From 6d77b155bcd4725e09837604e6ea86f5f124ba9c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 5 Dec 2023 20:10:48 +0100 Subject: Third commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- testutil/get-datatype-description.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'testutil/get-datatype-description.c') 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 #include +#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); -- cgit v1.2.3-70-g09d2