X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/d546887cd6d807f258fc4fb2f47a655310e356ba..1943156e7ba5c0318a54369a52297f74bad7b5b9:/t/randomdecl.c diff --git a/t/randomdecl.c b/t/randomdecl.c index 177f553..f4b00bc 100644 --- a/t/randomdecl.c +++ b/t/randomdecl.c @@ -1,6 +1,6 @@ /* * Generate random C declarations for testing. - * Copyright © 2012, 2020, 2022-2023 Nick Bowler + * Copyright © 2012, 2020, 2022-2024 Nick Bowler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,13 +24,13 @@ #include #include #include -#include +#include "cdecl.h" #include "declgen.h" -#include "test.h" #define PROGNAME "randomdecl" -static const char *progname = PROGNAME; +#include "test.h" + static const char sopts[] = "s:n:ECVH"; static const struct option lopts[] = { { "seed", 1, NULL, 's' }, @@ -44,7 +44,7 @@ static const struct option lopts[] = { enum { MODE_CDECL, - MODE_ENGLISH, + MODE_ENGLISH }; static void print_usage(FILE *f) @@ -67,7 +67,7 @@ static struct cdecl *random_decl(struct test_rng *rng) unsigned flags = 0; decl = malloc_nofail(sizeof *decl); - *decl = (struct cdecl) { 0 }; + decl->next = NULL; decl->declarators = gen_declarators(rng); if (decl->declarators->type != CDECL_DECL_FUNCTION) @@ -137,7 +137,7 @@ int main(int argc, char **argv) } if (count_str && !test_strtoul(&count, count_str)) { - fprintf(stderr, "%s: invalid count: %s\n", progname, count_str); + print_error("invalid count: %s", count_str); return EXIT_FAILURE; }