Module Name: src Committed By: rillig Date: Tue Sep 12 06:51:02 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: msg_192.c Log Message: tests/lint: show that '?:' skips untaken branches early This is probably done to avoid wrong warnings from branches that are only taken on other platforms, but it also generates a wrong 'unused' warning. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_192.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_192.c diff -u src/tests/usr.bin/xlint/lint1/msg_192.c:1.6 src/tests/usr.bin/xlint/lint1/msg_192.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_192.c:1.6 Sun Jul 9 11:18:55 2023 +++ src/tests/usr.bin/xlint/lint1/msg_192.c Tue Sep 12 06:51:02 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_192.c,v 1.6 2023/07/09 11:18:55 rillig Exp $ */ +/* $NetBSD: msg_192.c,v 1.7 2023/09/12 06:51:02 rillig Exp $ */ # 3 "msg_192.c" // Test for message: '%s' unused in function '%s' [192] @@ -12,3 +12,32 @@ example(int param) /* expect+1: warning: 'local' unused in function 'example' [192] */ int local; } + + +void assertion_failed(const char *); + +void +assert_true(void) +{ + sizeof(char) == 1 + ? (void)0 +/* FIXME: '__func__' is used, the code is just not reachable. */ +/* expect+1: warning: '__func__' unused in function 'assert_true' [192] */ + : assertion_failed(__func__); +} + +void +assert_false(void) +{ + sizeof(char) == 0 + ? (void)0 + : assertion_failed(__func__); +} + +void +assert_unknown(_Bool cond) +{ + cond + ? (void)0 + : assertion_failed(__func__); +}