]> git.draconx.ca Git - cdecl99.git/commitdiff
tests: Remove some unneeded C99 syntax.
authorNick Bowler <nbowler@draconx.ca>
Sat, 6 Jan 2024 21:59:33 +0000 (16:59 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 7 Jan 2024 01:48:51 +0000 (20:48 -0500)
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.

common
t/declgen.h
t/gen-typegen.awk
t/randomdecl.c

diff --git a/common b/common
index b045c0c5e35a1558e6b77d99e0ed8ab86d6dc550..aaaacebf1f04c364803f308c3b3e9670e216da09 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit b045c0c5e35a1558e6b77d99e0ed8ab86d6dc550
+Subproject commit aaaacebf1f04c364803f308c3b3e9670e216da09
index 714efd24f42515109f15dccd76d90f2065f8eaac..61a6d85863c31e6b60f67f4dd9ae7ec2fc06342c 100644 (file)
@@ -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;
index ee94b0ebb06b0823b67cfc56a9d88d30bf74315b..0fb1a497589da8729104b2e21aa170a87fee993c 100755 (executable)
@@ -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 *"
index 156e51c4842ba4ea4e375cc92651b97eb9c8e761..f4b00bc622c34a5f52acbce480f32ef0bdc37a28 100644 (file)
@@ -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)