Module Name: src Committed By: rillig Date: Sun Nov 28 09:47:18 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: emit.c emit.exp-ln Log Message: tests/lint1: reproduce parse error for accidentally exported name Seen in usr.sbin/cpuctl/aarch64.c line 118. error: aarch64.ln:857: not alnum or _: (for '118d-1.0d1200000000_tmpA16PcC') The name 00000000_tmp was not supposed to be exported. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/emit.c \ src/tests/usr.bin/xlint/lint1/emit.exp-ln 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/emit.c diff -u src/tests/usr.bin/xlint/lint1/emit.c:1.7 src/tests/usr.bin/xlint/lint1/emit.c:1.8 --- src/tests/usr.bin/xlint/lint1/emit.c:1.7 Fri Sep 10 20:02:51 2021 +++ src/tests/usr.bin/xlint/lint1/emit.c Sun Nov 28 09:47:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emit.c,v 1.7 2021/09/10 20:02:51 rillig Exp $ */ +/* $NetBSD: emit.c,v 1.8 2021/11/28 09:47:18 rillig Exp $ */ # 3 "emit.c" /* @@ -285,3 +285,22 @@ use_vars(void) declared_used_var++; defined_used_var++; } + +/* + * Since C99, an initializer may contain a compound expression. This allows + * to create trees of pointer data structures at compile time. + * + * The objects that are created for these compound literals are unnamed, + * therefore there is no point in exporting them to the .ln file. + * + * Before TODO, lint exported them. + */ +struct compound_expression_in_initializer { + const char * const *info; +}; + +struct compound_expression_in_initializer compound = { + .info = (const char *[16]){ + [0] = "zero", + }, +}; Index: src/tests/usr.bin/xlint/lint1/emit.exp-ln diff -u src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.7 src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.8 --- src/tests/usr.bin/xlint/lint1/emit.exp-ln:1.7 Sat Sep 4 15:13:00 2021 +++ src/tests/usr.bin/xlint/lint1/emit.exp-ln Sun Nov 28 09:47:18 2021 @@ -81,3 +81,6 @@ Semit.c 285u0.285x17declared_used_var 286u0.286x16defined_used_var 283d0.283d8use_varsF0V +302d0.302d8compoundsT134compound_expression_in_initializer +303d-1.0d1200000000_tmpA16PcC +305u0.305x1200000000_tmp