diff options
Diffstat (limited to '')
-rw-r--r-- | testutil/get-datatype-description.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/testutil/get-datatype-description.c b/testutil/get-datatype-description.c index 0bec618..9c26626 100644 --- a/testutil/get-datatype-description.c +++ b/testutil/get-datatype-description.c @@ -6,18 +6,30 @@ #include <stdio.h> #include <stdlib.h> +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wunsafe-buffer-usage" /* clang is just being silly */ +#endif + int -main(int argc, char *argv[]) +main(int argc, char **argv) { - enum libsyscalls_os os = (enum libsyscalls_os)atoi(argv[1]); - enum libsyscalls_arch arch = (enum libsyscalls_arch)atoi(argv[2]); - enum libsyscalls_datatype type = (enum libsyscalls_datatype)atoi(argv[3]); + int os, arch, type; struct libsyscalls_datatype_description desc; enum libsyscalls_error err; size_t i; - err = libsyscalls_get_datatype_description(os, arch, type, &desc); + if (argc != 7) { + fprintf(stderr, "usage error\n"); + return 3; + } + + os = atoi(argv[1]); + arch = atoi(argv[2]); + type = atoi(argv[3]); + + err = libsyscalls_get_datatype_description((enum libsyscalls_os)os, (enum libsyscalls_arch)arch, + (enum libsyscalls_datatype)type, &desc); if (err) { fprintf(stderr, "libsyscalls_get_datatype_description %s %s %s: ", argv[4], argv[5], argv[6]); libsyscalls_perror(NULL, err); @@ -28,10 +40,10 @@ main(int argc, char *argv[]) printf("array_size = %u\n", desc.array_size); printf("relative_position_of_array_size = %i\n", desc.relative_position_of_array_size); printf("absolute_position_of_array_size = %i\n", desc.absolute_position_of_array_size); - printf("fill_is_known = %u\n", desc.fill_is_known); - printf("is_signed = %u\n", desc.is_signed); - printf("is_unsigned = %u\n", desc.is_unsigned); - printf("min_is_minus_max = %u\n", desc.min_is_minus_max); + printf("fill_is_known = %u\n", (unsigned)desc.fill_is_known); + printf("is_signed = %u\n", (unsigned)desc.is_signed); + printf("is_unsigned = %u\n", (unsigned)desc.is_unsigned); + printf("min_is_minus_max = %u\n", (unsigned)desc.min_is_minus_max); printf("sign_representation = %lli\n", (long long int)desc.sign_representation); printf("annotation = %lli\n", (long long int)desc.annotation); printf("section = %lli\n", (long long int)desc.section); |