Module Name: src Committed By: rillig Date: Tue Aug 1 19:52:16 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: d_packed_structs.c decl.c Log Message: tests/lint: test packed and in-parameter declarations To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_packed_structs.c cvs rdiff -u -r1.25 -r1.26 src/tests/usr.bin/xlint/lint1/decl.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_packed_structs.c diff -u src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.4 src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.5 --- src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.4 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/d_packed_structs.c Tue Aug 1 19:52:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_packed_structs.c,v 1.4 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: d_packed_structs.c,v 1.5 2023/08/01 19:52:15 rillig Exp $ */ # 3 "d_packed_structs.c" /* packed tests */ @@ -39,3 +39,8 @@ struct y { }; int a[sizeof(struct y) - sizeof(struct x) - 1]; + +/* expect+1: error: negative array dimension (-9) [20] */ +typedef int sizeof_x[-(int)sizeof(struct x)]; +/* expect+1: error: negative array dimension (-16) [20] */ +typedef int sizeof_y[-(int)sizeof(struct y)]; Index: src/tests/usr.bin/xlint/lint1/decl.c diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.25 src/tests/usr.bin/xlint/lint1/decl.c:1.26 --- src/tests/usr.bin/xlint/lint1/decl.c:1.25 Mon Jul 31 20:52:26 2023 +++ src/tests/usr.bin/xlint/lint1/decl.c Tue Aug 1 19:52:15 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.25 2023/07/31 20:52:26 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.26 2023/08/01 19:52:15 rillig Exp $ */ # 3 "decl.c" /* @@ -229,3 +229,15 @@ symbol_type_in_unnamed_bit_field_member( int named_member; }; } + +// Symbols that are defined in the parameter list of a function definition can +// be accessed in the body of the function, even if they are nested. +int +get_x(struct point3d { struct point3d_number { int v; } x, y, z; } arg) +{ +/* expect-1: warning: dubious tag declaration 'struct point3d' [85] */ +/* expect-2: warning: dubious tag declaration 'struct point3d_number' [85] */ + static struct point3d local; + static struct point3d_number z; + return arg.x.v + local.x.v + z.v; +}