diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-10-16 22:25:28 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-10-16 22:25:28 +0200 |
commit | c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde (patch) | |
tree | 81a07d8a2494fcf0bd430fa74716dd85b766bc2d /gen/bits/intconf.c | |
parent | update todo (diff) | |
download | slibc-c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde.tar.gz slibc-c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde.tar.bz2 slibc-c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde.tar.xz |
the compiler determines how wchar is implement + intconf.h contains the signess of char
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'gen/bits/intconf.c')
-rw-r--r-- | gen/bits/intconf.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gen/bits/intconf.c b/gen/bits/intconf.c index 2ba2754..8d1311b 100644 --- a/gen/bits/intconf.c +++ b/gen/bits/intconf.c @@ -17,10 +17,16 @@ */ #include <stdio.h> #include <string.h> +#include <stddef.h> #include <time.h> +volatile char nul = 0; +volatile wchar_t wnul = 0; + + + /** * On my amd64 machine, the usual result is: * int_fast8_t = int32_t @@ -109,6 +115,7 @@ int main(int argc, char* argv[]) r |= printf("LONG_BIT %zu\n", 8 * sizeof(long int)); r |= printf("LONG_LONG_BIT %zu\n", 8 * sizeof(long long int)); r |= printf("PTR_BIT %zu\n", 8 * sizeof(void*)); + r |= printf("WCHAR_BIT %zu\n", 8 * sizeof(L'\0')); r |= printf("INT%zu %s\n", 8 * sizeof(char), "char"); r |= printf("INT%zu %s\n", 8 * sizeof(short int), "short int"); @@ -123,6 +130,19 @@ int main(int argc, char* argv[]) else if (!strcmp(argv[1], "fast16")) r = fast(16); else if (!strcmp(argv[1], "fast32")) r = fast(32); else if (!strcmp(argv[1], "fast64")) r = fast(64); + else if (!strcmp(argv[1], "char-signed")) + { + nul = ~nul; + r = !(nul > 0); + return printf("%i\n", r) < 0 ? 1 : 0; + } + else if (!strcmp(argv[1], "wchar-signed")) + { + wnul = ~wnul; + r = !(wnul > 0); + return printf("%i\n", r) < 0 ? 1 : 0; + } + if (r <= 0) return 1; return printf("%i\n", r) < 0 ? 1 : 0; |