# HG changeset patch # User Tassilo Philipp # Date 1643234647 -3600 # Node ID 54c1dc2e6ea526758dde3fb09d40909f8c7bb449 # Parent 4bd3ed699de8c994842d1b340ff0a700eb941139 suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them) diff -r 4bd3ed699de8 -r 54c1dc2e6ea5 test/suite_aggrs/cases.c --- a/test/suite_aggrs/cases.c Wed Jan 26 18:41:31 2022 +0100 +++ b/test/suite_aggrs/cases.c Wed Jan 26 23:04:07 2022 +0100 @@ -47,7 +47,13 @@ #define a void* /* all generated aggregates */ #include "dyncall.h" -#include "cases.h" + +#if defined(DC__OS_Plan9) +/* Plan9 pcc does not allow empty structs */ +# include "nonemptystructs.h" +#else +# include "cases.h" +#endif int G_ncases = sizeof(G_sigtab)/sizeof(G_sigtab[0]); int G_naggs = sizeof(G_agg_sigs)/sizeof(G_agg_sigs[0]); diff -r 4bd3ed699de8 -r 54c1dc2e6ea5 test/suite_aggrs/config.lua --- a/test/suite_aggrs/config.lua Wed Jan 26 18:41:31 2022 +0100 +++ b/test/suite_aggrs/config.lua Wed Jan 26 23:04:07 2022 +0100 @@ -2,6 +2,7 @@ minargs = 0 maxargs = 16 maxaggrdepth = 3 -- max nesting depth of aggregates, 1 = no nesting +emptyaggrs = true -- whether to allow empty aggregates or not ncases = 800 types = "csijlpfd{}" seed = 2112 diff -r 4bd3ed699de8 -r 54c1dc2e6ea5 test/suite_aggrs/rand-sig.lua --- a/test/suite_aggrs/rand-sig.lua Wed Jan 26 18:41:31 2022 +0100 +++ b/test/suite_aggrs/rand-sig.lua Wed Jan 26 23:04:07 2022 +0100 @@ -52,8 +52,8 @@ sig[#sig+1] = mktype(types:sub(id,id), 0, math.random(maxaggrdepth)) -- random depth avoids excessive nesting end l = table.concat(sig) - -- reject dupes and sigs without any aggregate, as this is about aggrs after all - until string.match(l, '{') ~= nil and uniq_sigs[l] == nil + -- reject dupes, sigs without any aggregate (as this is about aggrs after all), and empty ones (if not wanted) + until string.match(l, '{') ~= nil and uniq_sigs[l] == nil and (emptyaggrs or string.match(l, '{}') == nil) uniq_sigs[l] = 1 io.write(l.."\n") end