From: Nick Bowler Date: Sat, 6 Jan 2024 21:59:33 +0000 (-0500) Subject: tests: Remove some unneeded C99 syntax. X-Git-Tag: v1.3~45 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/dd59ec37f1b1594b41e0ad728c7af7e3fe54c562 tests: Remove some unneeded C99 syntax. A couple compound literals, designated initializers, and trailing commas in enum declarations remain in the test suite. This is not needed, we can use C89 syntax easily here. --- diff --git a/common b/common index b045c0c..aaaaceb 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit b045c0c5e35a1558e6b77d99e0ed8ab86d6dc550 +Subproject commit aaaacebf1f04c364803f308c3b3e9670e216da09 diff --git a/t/declgen.h b/t/declgen.h index 714efd2..61a6d85 100644 --- a/t/declgen.h +++ b/t/declgen.h @@ -1,6 +1,6 @@ /* * Generate random C declarations for testing. - * Copyright © 2012, 2022-2023 Nick Bowler + * Copyright © 2012, 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 @@ -23,7 +23,7 @@ enum { GEN_NO_FUNCTION = 0x01, GEN_NO_STORAGE = 0x02, GEN_NO_VOID = 0x04, - GEN_ONLY_REGISTER = 0x08, + GEN_ONLY_REGISTER = 0x08 }; struct test_rng; diff --git a/t/gen-typegen.awk b/t/gen-typegen.awk index ee94b0e..0fb1a49 100755 --- a/t/gen-typegen.awk +++ b/t/gen-typegen.awk @@ -34,10 +34,12 @@ $0 ~ /^[abcdefghijklmnopqrstuvwxyz_]/ { } END { - print "static inline struct cdecl_declspec *" - print "gen_raw_typespec_(unsigned type, struct cdecl_declspec *next)\n{" - print "\tstruct cdecl_declspec *s = malloc_nofail(sizeof *s);" - print "\t*s = (struct cdecl_declspec) { .next = next, .type = type };" + print "static inline struct cdecl_declspec *"; + print "gen_raw_typespec_(unsigned type, struct cdecl_declspec *next)\n{"; + print "\tstruct cdecl_declspec *s = malloc_nofail(sizeof *s);"; + print "\ts->type = type;"; + print "\ts->next = next;"; + print "\ts->ident = 0;"; print "\treturn s;\n}\n" print "static inline struct cdecl_declspec *" diff --git a/t/randomdecl.c b/t/randomdecl.c index 156e51c..f4b00bc 100644 --- a/t/randomdecl.c +++ b/t/randomdecl.c @@ -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)