headers/locale: Make result of `localeconv()` accord to GCC's `-funsigned-char` option
This enables the old behavior when `-funsigned-char` is specified.
The `selectany` attribute is assumed to be supported since GCC 4.2, and
probably by Clang as well.
This test program should print 127 when `char` is signed and 255 when it
is unsigned:
#include <stdio.h>
#include <locale.h>
int main(void)
{
struct lconv* lc = localeconv();
printf("frac_digits = %d\n", lc->frac_digits);
}
Reference: https://sourceforge.net/p/mingw-w64/mailman/message/37300502/
Reference: https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gcc/Variable-Attributes.html
Signed-off-by: Liu Hao <lh_mouse@126.com>
2 files changed