Mercurial > pub > dyncall > dyncall
changeset 446:54c1dc2e6ea5
suite_aggrs: added knob to enable/disable generation of empty structs (some compilers like Plan9's pcc don't allow them)
author | Tassilo Philipp |
---|---|
date | Wed, 26 Jan 2022 23:04:07 +0100 |
parents | 4bd3ed699de8 |
children | 97fff5d9cea1 |
files | test/suite_aggrs/cases.c test/suite_aggrs/config.lua test/suite_aggrs/rand-sig.lua |
diffstat | 3 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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]);
--- 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
--- 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