https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116163
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I have this awk script as a git pre-commit hook: #!/usr/bin/awk -f # Usage: badtests.awk [-v std_mode=NN] FILE... # Check each FILE for logic errors in dejagnu directives. # This is intended for the libstdc++ testsuite and not tested on other tests. BEGINFILE { dgrequire = dgdo = compile = xfail = options = addoptions = verify = testbool = 0 if (std_mode == 0) std_mode = 17 # default -std of GCC release being tested } /{ dg-require/ { ++dgrequire } /{ dg-do .* } / { ++dgdo if (dgrequire) print FILENAME " has dg-do after dg-require-*" } /{ (dg-do .* target|dg-require-effective-target) c\+\+(17|2.) / { match($0, "target c\\+\\+(..)", a) if (a[2] > std_mode) print FILENAME " will not run without a suitable -std option" } /{ dg-do compile .* }/ { ++compile } /{ dg-do [^r].* xfail .* }/ { ++xfail } /{ dg-options/ { ++options if (addoptions) print FILENAME " has dg-options after dg-add-options" if (match($0, "-std=(gnu|c)\\+\\+(17|2.)", a) != 0) { std_mode = a[2] } } /{ dg-add-options/ { ++addoptions } /VERIFY/ { ++verify } /bool test .*attribute.*unused/ { ++testbool } ENDFILE { if (dgdo > 1) print FILENAME " has multiple dg-do directives" if (compile > 0 && verify > 0) print FILENAME " uses VERIFY in a compile-only test" if (xfail > 0) print FILENAME " uses 'xfail' when do-what-keyword != 'run'" if (options > 1) print FILENAME " has multiple dg-options directives" if (testbool > 1 && verify == 0) print FILENAME " has bool test but doesn't use VERIFY" }