From 9628bd06223d7e1730574ca0c93d76b1d39856b4 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 29 Feb 2012 20:29:58 -0500 Subject: [PATCH] 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. --- test/declgen.c | 4 ++-- tests/crossparse-c-random.sh | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) 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" -- 2.43.0