From: Nick Bowler Date: Thu, 1 Mar 2012 01:29:58 +0000 (-0500) Subject: Don't generate invalid void function parameters in randomdecl. X-Git-Tag: v1~57 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/9628bd06223d7e1730574ca0c93d76b1d39856b4?hp=e031b4f0220432aef6e1864ea6359353dbd8aed3 Don't generate invalid void function parameters in randomdecl. Only parameters that are pointers or functions may have the "void" type specifier. This apparently doesn't come up often, so increase the default number of test iterations to make it more likely. --- diff --git a/test/declgen.c b/test/declgen.c index b9fb733..ac9d23e 100644 --- a/test/declgen.c +++ b/test/declgen.c @@ -306,8 +306,8 @@ static void gen_function(struct gen_rng *rng, struct cdecl_declarator *d) .declarators = gen_declarators(rng), }; - if (param->declarators->type == CDECL_DECL_ARRAY - || param->declarators->type == CDECL_DECL_IDENT) + if (param->declarators->type != CDECL_DECL_POINTER + && param->declarators->type != CDECL_DECL_FUNCTION) flags |= GEN_NO_VOID; param->specifiers = gen_declspecs(rng, flags); diff --git a/tests/crossparse-c-random.sh b/tests/crossparse-c-random.sh index 03ec30f..8fb1b63 100755 --- a/tests/crossparse-c-random.sh +++ b/tests/crossparse-c-random.sh @@ -8,7 +8,7 @@ # This is free software: you are free to do what the fuck you want to. # There is NO WARRANTY, to the extent permitted by law. -: "${RANDOMSEED=$RANDOM}" "${TESTITER=100}" +: "${RANDOMSEED=$RANDOM}" "${TESTITER=500}" randomdecl=test/randomdecl$EXEEXT crossparse=test/crossparse$EXEEXT @@ -21,7 +21,10 @@ proc() { while read decl do count=`expr $count + 1` - $crossparse "$decl" || { result=fail; break; } + $crossparse "$decl" || { result=fail + printf 'original input: %s\n' "$decl" 1>&2 + break + } done echo "result=$result"