Module Name: src Committed By: rillig Date: Thu Sep 7 06:17:35 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: msg_196.c Log Message: tests/lint: test case labels with out-of-bounds values To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_196.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/msg_196.c diff -u src/tests/usr.bin/xlint/lint1/msg_196.c:1.3 src/tests/usr.bin/xlint/lint1/msg_196.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_196.c:1.3 Thu Jun 16 16:58:36 2022 +++ src/tests/usr.bin/xlint/lint1/msg_196.c Thu Sep 7 06:17:35 2023 @@ -1,8 +1,20 @@ -/* $NetBSD: msg_196.c,v 1.3 2022/06/16 16:58:36 rillig Exp $ */ +/* $NetBSD: msg_196.c,v 1.4 2023/09/07 06:17:35 rillig Exp $ */ # 3 "msg_196.c" // Test for message: case label affected by conversion [196] -/* expect+1: error: syntax error ':' [249] */ -TODO: "Add example code that triggers the above message." -TODO: "Add example code that almost triggers the above message." +/* lint1-extra-flags: -X 351 */ + +void +switch_int_unsigned(int x) +{ + switch (x) { + /* expect+1: warning: case label affected by conversion [196] */ + case (unsigned int)-1: + /* expect+1: warning: case label affected by conversion [196] */ + case -2U: + /* expect+1: warning: case label affected by conversion [196] */ + case 0x1000200030004000ULL: + return; + } +}