Module Name: src Committed By: rillig Date: Sun Jul 2 22:50:18 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: d_gcc_compound_statements1.c Log Message: tests/lint: demonstrate empty statement in GCC statement expression Seen in external/mit/xorg/lib/dri.old. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c diff -u src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c:1.12 src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c:1.13 --- src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c:1.12 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c Sun Jul 2 22:50:18 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_gcc_compound_statements1.c,v 1.12 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: d_gcc_compound_statements1.c,v 1.13 2023/07/02 22:50:18 rillig Exp $ */ # 3 "d_gcc_compound_statements1.c" /* GCC compound statement with expression */ @@ -65,3 +65,19 @@ crash(void) ; }); } + +/* + * Before 2023-07-03, lint did not accept empty statements in GCC statement + * expressions. These empty statements can be generated by a disabled 'assert' + * macro. + */ +unsigned int +empty_statement(void) +{ + return ({ + unsigned int mega = 1 << 20; + /* expect+1: error: syntax error ';' [249] */ + ; + mega; + }); +}