Module Name: src Committed By: rillig Date: Sun Jul 9 11:01:27 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: d_c99_init.c decl_arg.c expr_fold.c msg_009.c msg_077.c msg_141.c msg_142.c msg_199.c msg_200.c msg_241.c msg_242.c msg_255.c msg_257.c msg_283.c msg_289.c msg_312.c msg_320.c src/usr.bin/xlint/lint1: decl.c err.c func.c lex.c tree.c Log Message: lint: clean up the wording of a few diagnostics To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/tests/usr.bin/xlint/lint1/d_c99_init.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/decl_arg.c cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/xlint/lint1/expr_fold.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_009.c \ src/tests/usr.bin/xlint/lint1/msg_289.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_077.c \ src/tests/usr.bin/xlint/lint1/msg_242.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_141.c \ src/tests/usr.bin/xlint/lint1/msg_257.c \ src/tests/usr.bin/xlint/lint1/msg_283.c cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/msg_142.c \ src/tests/usr.bin/xlint/lint1/msg_241.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_199.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_200.c \ src/tests/usr.bin/xlint/lint1/msg_255.c \ src/tests/usr.bin/xlint/lint1/msg_312.c \ src/tests/usr.bin/xlint/lint1/msg_320.c cvs rdiff -u -r1.345 -r1.346 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.206 -r1.207 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.165 -r1.166 src/usr.bin/xlint/lint1/func.c cvs rdiff -u -r1.169 -r1.170 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.555 -r1.556 src/usr.bin/xlint/lint1/tree.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_c99_init.c diff -u src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.45 src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.46 --- src/tests/usr.bin/xlint/lint1/d_c99_init.c:1.45 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/d_c99_init.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: d_c99_init.c,v 1.45 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: d_c99_init.c,v 1.46 2023/07/09 11:01:27 rillig Exp $ */ # 3 "d_c99_init.c" /* @@ -407,7 +407,7 @@ ensure_array_type_is_not_modified_during switch (4) { case sizeof(array_of_unknown_size): - /* expect+1: error: duplicate case in switch: 0 [199] */ + /* expect+1: error: duplicate case '0' in switch [199] */ case 0: case 3: case 4: Index: src/tests/usr.bin/xlint/lint1/decl_arg.c diff -u src/tests/usr.bin/xlint/lint1/decl_arg.c:1.8 src/tests/usr.bin/xlint/lint1/decl_arg.c:1.9 --- src/tests/usr.bin/xlint/lint1/decl_arg.c:1.8 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/decl_arg.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl_arg.c,v 1.8 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: decl_arg.c,v 1.9 2023/07/09 11:01:27 rillig Exp $ */ # 3 "decl_arg.c" /* @@ -31,7 +31,7 @@ void type_qualifier_pointer(const number extern void old_style(an_int, a_const_int, a_number, a_function, a_struct) /* expect+2: warning: empty declaration [2] */ -/* expect+1: error: only register valid as formal parameter storage class [9] */ +/* expect+1: error: only 'register' is valid as storage class in parameter [9] */ static; /* expect+1: error: syntax error '"' [249] */ static "error"; @@ -115,7 +115,7 @@ void cover_direct_notype_param_decl( /* * Just some unrealistic code to cover the grammar rule parameter_declaration. */ -/* expect+4: error: only register valid as formal parameter storage class [9] */ +/* expect+4: error: only 'register' is valid as storage class in parameter [9] */ void cover_parameter_declaration( volatile, /* 1 */ double, /* 2 */ Index: src/tests/usr.bin/xlint/lint1/expr_fold.c diff -u src/tests/usr.bin/xlint/lint1/expr_fold.c:1.9 src/tests/usr.bin/xlint/lint1/expr_fold.c:1.10 --- src/tests/usr.bin/xlint/lint1/expr_fold.c:1.9 Sun Jul 2 18:14:44 2023 +++ src/tests/usr.bin/xlint/lint1/expr_fold.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: expr_fold.c,v 1.9 2023/07/02 18:14:44 rillig Exp $ */ +/* $NetBSD: expr_fold.c,v 1.10 2023/07/09 11:01:27 rillig Exp $ */ # 3 "expr_fold.c" /* @@ -59,10 +59,10 @@ fold_uminus(void) /* The '-' is an operator, it is not part of the integer constant. */ take_int(-2147483648); - /* expect+2: warning: integer overflow detected, op '+' [141] */ - /* expect+1: warning: integer overflow detected, op '-' [141] */ + /* expect+2: warning: operator '+' produces integer overflow [141] */ + /* expect+1: warning: operator '-' produces integer overflow [141] */ take_int(-(2147483647 + 1)); - /* expect+1: warning: integer overflow detected, op '-' [141] */ + /* expect+1: warning: operator '-' produces integer overflow [141] */ take_int(-(-2147483647 - 1)); /* expect+1: warning: conversion of 'long' to 'int' is out of range, arg #1 [295] */ take_int(-(4294967295)); @@ -100,14 +100,14 @@ void fold_mult(void) { take_int(32767 * 65536); - /* expect+1: warning: integer overflow detected, op '*' [141] */ + /* expect+1: warning: operator '*' produces integer overflow [141] */ take_int(32768 * 65536); - /* expect+1: warning: integer overflow detected, op '*' [141] */ + /* expect+1: warning: operator '*' produces integer overflow [141] */ take_int(65536 * 65536); take_uint(32767 * 65536U); take_uint(32768 * 65536U); - /* expect+1: warning: integer overflow detected, op '*' [141] */ + /* expect+1: warning: operator '*' produces integer overflow [141] */ take_uint(65536 * 65536U); } @@ -116,7 +116,7 @@ fold_div(void) { /* expect+3: error: division by 0 [139] */ /* XXX: The following message is redundant. */ - /* expect+1: warning: integer overflow detected, op '/' [141] */ + /* expect+1: warning: operator '/' produces integer overflow [141] */ take_int(0 / 0); /* expect+1: warning: conversion of 'long' to 'int' is out of range, arg #1 [295] */ @@ -141,13 +141,13 @@ fold_mod(void) void fold_plus(void) { - /* expect+1: warning: integer overflow detected, op '+' [141] */ + /* expect+1: warning: operator '+' produces integer overflow [141] */ take_int(2147483647 + 1); /* Assume two's complement, so no overflow. */ take_int(-2147483647 + -1); - /* expect+1: warning: integer overflow detected, op '+' [141] */ + /* expect+1: warning: operator '+' produces integer overflow [141] */ take_int(-2147483647 + -2); /* @@ -164,25 +164,25 @@ fold_plus(void) void fold_minus(void) { - /* expect+1: warning: integer overflow detected, op '-' [141] */ + /* expect+1: warning: operator '-' produces integer overflow [141] */ take_int(2147483647 - -1); /* Assume two's complement. */ take_int(-2147483647 - 1); - /* expect+1: warning: integer overflow detected, op '-' [141] */ + /* expect+1: warning: operator '-' produces integer overflow [141] */ take_int(-2147483647 - 2); take_int(0 - 2147483648); - /* expect+1: warning: integer overflow detected, op '-' [141] */ + /* expect+1: warning: operator '-' produces integer overflow [141] */ take_uint(0 - 2147483648U); } void fold_shl(void) { - /* expect+1: warning: integer overflow detected, op '<<' [141] */ + /* expect+1: warning: operator '<<' produces integer overflow [141] */ take_int(1 << 24 << 24); - /* expect+1: warning: integer overflow detected, op '<<' [141] */ + /* expect+1: warning: operator '<<' produces integer overflow [141] */ take_uint(1U << 24 << 24); /* FIXME: undefined behavior in 'fold' at 'uint64_t << 104'. */ @@ -296,7 +296,7 @@ struct ctassert5_struct { void unary_minus_overflow(unsigned long long val) { - /* expect+1: warning: integer overflow detected, op '-' [141] */ + /* expect+1: warning: operator '-' produces integer overflow [141] */ if (val > -(unsigned long long)(-0x7fffffffffffffffL - 1)) return; } Index: src/tests/usr.bin/xlint/lint1/msg_009.c diff -u src/tests/usr.bin/xlint/lint1/msg_009.c:1.5 src/tests/usr.bin/xlint/lint1/msg_009.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_009.c:1.5 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_009.c Sun Jul 9 11:01:27 2023 @@ -1,15 +1,15 @@ -/* $NetBSD: msg_009.c,v 1.5 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_009.c,v 1.6 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_009.c" -// Test for message: only register valid as formal parameter storage class [9] +// Test for message: only 'register' is valid as storage class in parameter [9] /* lint1-extra-flags: -X 351 */ -/* expect+1: error: only register valid as formal parameter storage class [9] */ +/* expect+1: error: only 'register' is valid as storage class in parameter [9] */ extern void typedef_example(typedef int param); -/* expect+1: error: only register valid as formal parameter storage class [9] */ +/* expect+1: error: only 'register' is valid as storage class in parameter [9] */ extern void auto_example(auto int param); -/* expect+1: error: only register valid as formal parameter storage class [9] */ +/* expect+1: error: only 'register' is valid as storage class in parameter [9] */ extern void static_example(static int param); -/* expect+1: error: only register valid as formal parameter storage class [9] */ +/* expect+1: error: only 'register' is valid as storage class in parameter [9] */ extern void extern_example(extern int param); Index: src/tests/usr.bin/xlint/lint1/msg_289.c diff -u src/tests/usr.bin/xlint/lint1/msg_289.c:1.5 src/tests/usr.bin/xlint/lint1/msg_289.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_289.c:1.5 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_289.c Sun Jul 9 11:01:27 2023 @@ -1,13 +1,13 @@ -/* $NetBSD: msg_289.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_289.c,v 1.6 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_289.c" -// Test for message: can't be used together: /* PRINTFLIKE */ /* SCANFLIKE */ [289] +// Test for message: /* PRINTFLIKE */ and /* SCANFLIKE */ cannot be combined [289] /* lint1-extra-flags: -X 351 */ /* PRINTFLIKE */ /* SCANFLIKE */ void both(void) -/* expect+1: warning: can't be used together: ** PRINTFLIKE ** ** SCANFLIKE ** [289] */ +/* expect+1: warning: ** PRINTFLIKE ** and ** SCANFLIKE ** cannot be combined [289] */ { } Index: src/tests/usr.bin/xlint/lint1/msg_077.c diff -u src/tests/usr.bin/xlint/lint1/msg_077.c:1.7 src/tests/usr.bin/xlint/lint1/msg_077.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_077.c:1.7 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_077.c Sun Jul 9 11:01:27 2023 @@ -1,11 +1,11 @@ -/* $NetBSD: msg_077.c,v 1.7 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_077.c,v 1.8 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_077.c" -/* Test for message: bad octal digit %c [77] */ +/* Test for message: bad octal digit '%c' [77] */ /* lint1-flags: -tw -X 351 */ -/* expect+1: warning: bad octal digit 8 [77] */ +/* expect+1: warning: bad octal digit '8' [77] */ char single_digit = '\8'; /* Index: src/tests/usr.bin/xlint/lint1/msg_242.c diff -u src/tests/usr.bin/xlint/lint1/msg_242.c:1.7 src/tests/usr.bin/xlint/lint1/msg_242.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_242.c:1.7 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_242.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_242.c,v 1.7 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_242.c,v 1.8 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_242.c" // Test for message: combination of '%s' and '%s', op '%s' [242] @@ -49,7 +49,7 @@ unnamed_enum(void) unsigned i = 3; - /* expect+3: warning: dubious operation on enum, op '*' [241] */ + /* expect+3: warning: dubious operation '*' on enum [241] */ /* FIXME: Combining 'unsigned int' with 'unsigned int' is OK. */ /* expect+1: warning: combination of 'unsigned int' and 'unsigned int', op '=' [242] */ i = compile_time_constant * i; Index: src/tests/usr.bin/xlint/lint1/msg_141.c diff -u src/tests/usr.bin/xlint/lint1/msg_141.c:1.6 src/tests/usr.bin/xlint/lint1/msg_141.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_141.c:1.6 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_141.c Sun Jul 9 11:01:27 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_141.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_141.c,v 1.7 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_141.c" -// Test for message: integer overflow detected, op '%s' [141] +// Test for message: operator '%s' produces integer overflow [141] /* lint1-extra-flags: -h -X 351 */ @@ -17,17 +17,17 @@ int signed_int_max = (1u << 31) - 1; */ unsigned int unsigned_int_max = (1u << 31) - 1; -/* expect+1: warning: integer overflow detected, op '+' [141] */ +/* expect+1: warning: operator '+' produces integer overflow [141] */ int int_overflow = (1 << 30) + (1 << 30); -/* expect+2: warning: integer overflow detected, op '+' [141] */ +/* expect+2: warning: operator '+' produces integer overflow [141] */ /* expect+1: warning: initialization of unsigned with negative constant [221] */ unsigned int intermediate_overflow = (1 << 30) + (1 << 30); unsigned int no_overflow = (1U << 30) + (1 << 30); -/* expect+1: warning: integer overflow detected, op '-' [141] */ +/* expect+1: warning: operator '-' produces integer overflow [141] */ unsigned int unsigned_int_min = 0u - (1u << 31); -/* expect+1: warning: integer overflow detected, op '-' [141] */ +/* expect+1: warning: operator '-' produces integer overflow [141] */ unsigned int unsigned_int_min_unary = -(1u << 31); Index: src/tests/usr.bin/xlint/lint1/msg_257.c diff -u src/tests/usr.bin/xlint/lint1/msg_257.c:1.6 src/tests/usr.bin/xlint/lint1/msg_257.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_257.c:1.6 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_257.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_257.c,v 1.6 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_257.c,v 1.7 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_257.c" // Test for message: extra characters in lint comment [257] @@ -16,7 +16,7 @@ void take(const void *); /* PRINTFLIKE 7 */ void my_printf(const char *fmt) -/* expect+1: warning: argument number mismatch with directive ** PRINTFLIKE ** [283] */ +/* expect+1: warning: argument number mismatch in comment ** PRINTFLIKE ** [283] */ { take(fmt); } Index: src/tests/usr.bin/xlint/lint1/msg_283.c diff -u src/tests/usr.bin/xlint/lint1/msg_283.c:1.6 src/tests/usr.bin/xlint/lint1/msg_283.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_283.c:1.6 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_283.c Sun Jul 9 11:01:27 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_283.c,v 1.6 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_283.c,v 1.7 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_283.c" -// Test for message: argument number mismatch with directive /* %s */ [283] +// Test for message: argument number mismatch in comment /* %s */ [283] /* Do not warn about unused parameters. */ /* lint1-extra-flags: -X 231,351 */ @@ -27,6 +27,6 @@ printflike_2_comment(int a, const char * /* PRINTFLIKE 3 */ void printflike_3_comment(int a, const char *fmt) -/* expect+1: warning: argument number mismatch with directive ** PRINTFLIKE ** [283] */ +/* expect+1: warning: argument number mismatch in comment ** PRINTFLIKE ** [283] */ { } Index: src/tests/usr.bin/xlint/lint1/msg_142.c diff -u src/tests/usr.bin/xlint/lint1/msg_142.c:1.10 src/tests/usr.bin/xlint/lint1/msg_142.c:1.11 --- src/tests/usr.bin/xlint/lint1/msg_142.c:1.10 Tue Apr 11 00:03:42 2023 +++ src/tests/usr.bin/xlint/lint1/msg_142.c Sun Jul 9 11:01:27 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_142.c,v 1.10 2023/04/11 00:03:42 rillig Exp $ */ +/* $NetBSD: msg_142.c,v 1.11 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_142.c" -// Test for message: floating point overflow on operator '%s' [142] +// Test for message: operator '%s' produces floating point overflow [142] /* lint1-extra-flags: -X 351 */ @@ -16,8 +16,8 @@ * multipliers is needed to produce an overflow. */ -/* expect+2: warning: floating point overflow on operator '*' [142] */ -/* expect+1: warning: floating point overflow on operator '*' [142] */ +/* expect+2: warning: operator '*' produces floating point overflow [142] */ +/* expect+1: warning: operator '*' produces floating point overflow [142] */ double dbl = 1e100 * 1e100 * 1e100 * 1e100 * 1e100; /* Index: src/tests/usr.bin/xlint/lint1/msg_241.c diff -u src/tests/usr.bin/xlint/lint1/msg_241.c:1.10 src/tests/usr.bin/xlint/lint1/msg_241.c:1.11 --- src/tests/usr.bin/xlint/lint1/msg_241.c:1.10 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_241.c Sun Jul 9 11:01:27 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_241.c,v 1.10 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_241.c,v 1.11 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_241.c" -// Test for message: dubious operation on enum, op '%s' [241] +// Test for message: dubious operation '%s' on enum [241] // // As of February 2021, the option -e is not enabled by default in // share/mk/sys.mk, therefore this message is neither well-known nor @@ -27,35 +27,35 @@ example(void) { enum color c = RED; - /* expect+1: warning: dubious operation on enum, op '!' [241] */ + /* expect+1: warning: dubious operation '!' on enum [241] */ sink_bool(!c); - /* expect+1: warning: dubious operation on enum, op '~' [241] */ + /* expect+1: warning: dubious operation '~' on enum [241] */ sink_color(~c); - /* expect+1: warning: dubious operation on enum, op '++x' [241] */ + /* expect+1: warning: dubious operation '++x' on enum [241] */ ++c; - /* expect+1: warning: dubious operation on enum, op '--x' [241] */ + /* expect+1: warning: dubious operation '--x' on enum [241] */ --c; - /* expect+1: warning: dubious operation on enum, op 'x++' [241] */ + /* expect+1: warning: dubious operation 'x++' on enum [241] */ c++; - /* expect+1: warning: dubious operation on enum, op 'x--' [241] */ + /* expect+1: warning: dubious operation 'x--' on enum [241] */ c--; - /* expect+1: warning: dubious operation on enum, op '+' [241] */ + /* expect+1: warning: dubious operation '+' on enum [241] */ sink_color(+c); - /* expect+1: warning: dubious operation on enum, op '-' [241] */ + /* expect+1: warning: dubious operation '-' on enum [241] */ sink_color(-c); - /* expect+1: warning: dubious operation on enum, op '*' [241] */ + /* expect+1: warning: dubious operation '*' on enum [241] */ sink_color(c * c); - /* expect+1: warning: dubious operation on enum, op '/' [241] */ + /* expect+1: warning: dubious operation '/' on enum [241] */ sink_color(c / c); - /* expect+1: warning: dubious operation on enum, op '%' [241] */ + /* expect+1: warning: dubious operation '%' on enum [241] */ sink_color(c % c); - /* expect+1: warning: dubious operation on enum, op '+' [241] */ + /* expect+1: warning: dubious operation '+' on enum [241] */ sink_color(c + c); - /* expect+1: warning: dubious operation on enum, op '-' [241] */ + /* expect+1: warning: dubious operation '-' on enum [241] */ sink_color(c - c); - /* expect+1: warning: dubious operation on enum, op '<<' [241] */ + /* expect+1: warning: dubious operation '<<' on enum [241] */ sink_color(c << c); - /* expect+1: warning: dubious operation on enum, op '>>' [241] */ + /* expect+1: warning: dubious operation '>>' on enum [241] */ sink_color(c >> c); sink_bool(c < c); @@ -65,50 +65,50 @@ example(void) sink_bool(c == c); sink_bool(c != c); - /* expect+1: warning: dubious operation on enum, op '&' [241] */ + /* expect+1: warning: dubious operation '&' on enum [241] */ sink_color(c & c); - /* expect+1: warning: dubious operation on enum, op '^' [241] */ + /* expect+1: warning: dubious operation '^' on enum [241] */ sink_color(c ^ c); - /* expect+1: warning: dubious operation on enum, op '|' [241] */ + /* expect+1: warning: dubious operation '|' on enum [241] */ sink_color(c | c); - /* expect+1: warning: dubious operation on enum, op '&&' [241] */ + /* expect+1: warning: dubious operation '&&' on enum [241] */ sink_bool(c && c); - /* expect+1: warning: dubious operation on enum, op '||' [241] */ + /* expect+1: warning: dubious operation '||' on enum [241] */ sink_bool(c || c); sink_color(c ? c : BLUE); c = GREEN; - /* expect+1: warning: dubious operation on enum, op '*=' [241] */ + /* expect+1: warning: dubious operation '*=' on enum [241] */ c *= c; - /* expect+1: warning: dubious operation on enum, op '/=' [241] */ + /* expect+1: warning: dubious operation '/=' on enum [241] */ c /= c; - /* expect+1: warning: dubious operation on enum, op '%=' [241] */ + /* expect+1: warning: dubious operation '%=' on enum [241] */ c %= c; - /* expect+1: warning: dubious operation on enum, op '+=' [241] */ + /* expect+1: warning: dubious operation '+=' on enum [241] */ c += c; - /* expect+1: warning: dubious operation on enum, op '-=' [241] */ + /* expect+1: warning: dubious operation '-=' on enum [241] */ c -= c; - /* expect+1: warning: dubious operation on enum, op '<<=' [241] */ + /* expect+1: warning: dubious operation '<<=' on enum [241] */ c <<= c; - /* expect+1: warning: dubious operation on enum, op '>>=' [241] */ + /* expect+1: warning: dubious operation '>>=' on enum [241] */ c >>= c; - /* expect+1: warning: dubious operation on enum, op '&=' [241] */ + /* expect+1: warning: dubious operation '&=' on enum [241] */ c &= c; - /* expect+1: warning: dubious operation on enum, op '^=' [241] */ + /* expect+1: warning: dubious operation '^=' on enum [241] */ c ^= c; - /* expect+1: warning: dubious operation on enum, op '|=' [241] */ + /* expect+1: warning: dubious operation '|=' on enum [241] */ c |= c; /* The cast to unsigned is required by GCC at WARNS=6. */ - /* expect+1: warning: dubious operation on enum, op '&=' [241] */ + /* expect+1: warning: dubious operation '&=' on enum [241] */ c &= ~(unsigned)GREEN; } void cover_typeok_enum(enum color c, int i) { - /* expect+2: warning: dubious operation on enum, op '*' [241] */ + /* expect+2: warning: dubious operation '*' on enum [241] */ /* expect+1: warning: combination of 'enum color' and 'int', op '>' [242] */ if (c * i > 5) return; Index: src/tests/usr.bin/xlint/lint1/msg_199.c diff -u src/tests/usr.bin/xlint/lint1/msg_199.c:1.3 src/tests/usr.bin/xlint/lint1/msg_199.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_199.c:1.3 Thu Jun 16 16:58:36 2022 +++ src/tests/usr.bin/xlint/lint1/msg_199.c Sun Jul 9 11:01:27 2023 @@ -1,8 +1,17 @@ -/* $NetBSD: msg_199.c,v 1.3 2022/06/16 16:58:36 rillig Exp $ */ +/* $NetBSD: msg_199.c,v 1.4 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_199.c" -// Test for message: duplicate case in switch: %ld [199] +// Test for message: duplicate case '%ld' in switch [199] -/* 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 +example(int x) +{ + switch (x) { + case 3: + /* expect+1: error: duplicate case '3' in switch [199] */ + case 3: + break; + } +} Index: src/tests/usr.bin/xlint/lint1/msg_200.c diff -u src/tests/usr.bin/xlint/lint1/msg_200.c:1.4 src/tests/usr.bin/xlint/lint1/msg_200.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_200.c:1.4 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_200.c Sun Jul 9 11:01:27 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_200.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_200.c,v 1.5 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_200.c" -// Test for message: duplicate case in switch: %lu [200] +// Test for message: duplicate case '%lu' in switch [200] /* lint1-extra-flags: -X 351 */ @@ -10,7 +10,7 @@ example(unsigned x) { switch (x) { case 3: - /* expect+1: error: duplicate case in switch: 3 [200] */ + /* expect+1: error: duplicate case '3' in switch [200] */ case 3: break; } Index: src/tests/usr.bin/xlint/lint1/msg_255.c diff -u src/tests/usr.bin/xlint/lint1/msg_255.c:1.4 src/tests/usr.bin/xlint/lint1/msg_255.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_255.c:1.4 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_255.c Sun Jul 9 11:01:27 2023 @@ -1,13 +1,13 @@ -/* $NetBSD: msg_255.c,v 1.4 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_255.c,v 1.5 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_255.c" -// Test for message: undefined or invalid # directive [255] +// Test for message: undefined or invalid '#' directive [255] /* lint1-extra-flags: -X 351 */ #pragma once -/* expect+1: warning: undefined or invalid # directive [255] */ +/* expect+1: warning: undefined or invalid '#' directive [255] */ #fatal_error int dummy; Index: src/tests/usr.bin/xlint/lint1/msg_312.c diff -u src/tests/usr.bin/xlint/lint1/msg_312.c:1.4 src/tests/usr.bin/xlint/lint1/msg_312.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_312.c:1.4 Fri Jun 17 18:54:53 2022 +++ src/tests/usr.bin/xlint/lint1/msg_312.c Sun Jul 9 11:01:27 2023 @@ -1,9 +1,9 @@ -/* $NetBSD: msg_312.c,v 1.4 2022/06/17 18:54:53 rillig Exp $ */ +/* $NetBSD: msg_312.c,v 1.5 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_312.c" -/* Test for message: %s does not support // comments [312] */ +/* Test for message: %s does not support '//' comments [312] */ /* lint1-flags: -tw */ -/* expect+1: warning: traditional C does not support // comments [312] */ +/* expect+1: warning: traditional C does not support '//' comments [312] */ // C99 comment Index: src/tests/usr.bin/xlint/lint1/msg_320.c diff -u src/tests/usr.bin/xlint/lint1/msg_320.c:1.4 src/tests/usr.bin/xlint/lint1/msg_320.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_320.c:1.4 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_320.c Sun Jul 9 11:01:27 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_320.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_320.c,v 1.5 2023/07/09 11:01:27 rillig Exp $ */ # 3 "msg_320.c" -// Test for message: ({ }) is a GCC extension [320] +// Test for message: '({ ... })' is a GCC extension [320] /* lint1-flags: -Sw -X 351 */ @@ -13,5 +13,5 @@ example(void) int square = base * base; square * base; }); - /* expect-1: warning: ({ }) is a GCC extension [320] */ + /* expect-1: warning: '({ ... })' is a GCC extension [320] */ } Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.345 src/usr.bin/xlint/lint1/decl.c:1.346 --- src/usr.bin/xlint/lint1/decl.c:1.345 Sat Jul 8 16:13:00 2023 +++ src/usr.bin/xlint/lint1/decl.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.345 2023/07/08 16:13:00 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.346 2023/07/09 11:01:27 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: decl.c,v 1.345 2023/07/08 16:13:00 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.346 2023/07/09 11:01:27 rillig Exp $"); #endif #include <sys/param.h> @@ -645,7 +645,7 @@ dcs_adjust_storage_class(void) } else if (dcs->d_kind == DLK_OLD_STYLE_ARGS || dcs->d_kind == DLK_PROTO_PARAMS) { if (dcs->d_scl != NOSCL && dcs->d_scl != REG) { - /* only register valid as formal parameter ... */ + /* only 'register' is valid as storage class ... */ error(9); dcs->d_scl = NOSCL; } @@ -2386,7 +2386,7 @@ check_func_lint_directives(void) /* check for illegal combinations of lint directives */ if (printflike_argnum != -1 && scanflike_argnum != -1) { - /* can't be used together: ** PRINTFLIKE ** ** SCANFLIKE ** */ + /* ** PRINTFLIKE ** and ** SCANFLIKE ** cannot be combined */ warning(289); printflike_argnum = scanflike_argnum = -1; } @@ -2406,24 +2406,24 @@ check_func_lint_directives(void) for (sym_t *arg = dcs->d_func_args; arg != NULL; arg = arg->s_next) narg++; if (nargusg > narg) { - /* argument number mismatch with directive ** %s ** */ + /* argument number mismatch in comment ** %s ** */ warning(283, "ARGSUSED"); nargusg = 0; } if (nvararg > narg) { - /* argument number mismatch with directive ** %s ** */ + /* argument number mismatch in comment ** %s ** */ warning(283, "VARARGS"); nvararg = 0; } if (printflike_argnum > narg) { - /* argument number mismatch with directive ** %s ** */ + /* argument number mismatch in comment ** %s ** */ warning(283, "PRINTFLIKE"); printflike_argnum = -1; } else if (printflike_argnum == 0) { printflike_argnum = -1; } if (scanflike_argnum > narg) { - /* argument number mismatch with directive ** %s ** */ + /* argument number mismatch in comment ** %s ** */ warning(283, "SCANFLIKE"); scanflike_argnum = -1; } else if (scanflike_argnum == 0) { Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.206 src/usr.bin/xlint/lint1/err.c:1.207 --- src/usr.bin/xlint/lint1/err.c:1.206 Sun Jul 9 10:42:07 2023 +++ src/usr.bin/xlint/lint1/err.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.206 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: err.c,v 1.207 2023/07/09 11:01:27 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: err.c,v 1.206 2023/07/09 10:42:07 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.207 2023/07/09 11:01:27 rillig Exp $"); #endif #include <limits.h> @@ -64,7 +64,7 @@ static const char *const msgs[] = { "use 'double' instead of 'long float'", /* 6 */ "only one storage class allowed", /* 7 */ "illegal storage class", /* 8 */ - "only register valid as formal parameter storage class", /* 9 */ + "only 'register' is valid as storage class in parameter", /* 9 */ "duplicate '%s'", /* 10 */ "bit-field initializer out of range", /* 11 */ "compiler takes size of function", /* 12 */ @@ -132,7 +132,7 @@ static const char *const msgs[] = { "no hex digits follow \\x", /* 74 */ "overflow in hex escape", /* 75 */ "character escape does not fit in character", /* 76 */ - "bad octal digit %c", /* 77 */ + "bad octal digit '%c'", /* 77 */ "", /* unused */ /* 78 */ "dubious escape \\%c", /* 79 */ "dubious escape \\%o", /* 80 */ @@ -196,8 +196,8 @@ static const char *const msgs[] = { "unknown operand size, op '%s'", /* 138 */ "division by 0", /* 139 */ "modulus by 0", /* 140 */ - "integer overflow detected, op '%s'", /* 141 */ - "floating point overflow on operator '%s'", /* 142 */ + "operator '%s' produces integer overflow", /* 141 */ + "operator '%s' produces floating point overflow", /* 142 */ "cannot take size/alignment of incomplete type", /* 143 */ "cannot take size/alignment of function type '%s'", /* 144 */ "cannot take size/alignment of bit-field", /* 145 */ @@ -254,8 +254,8 @@ static const char *const msgs[] = { "case label affected by conversion", /* 196 */ "non-constant case expression", /* 197 */ "non-integral case expression", /* 198 */ - "duplicate case in switch: %ld", /* 199 */ - "duplicate case in switch: %lu", /* 200 */ + "duplicate case '%ld' in switch", /* 199 */ + "duplicate case '%lu' in switch", /* 200 */ "default outside switch", /* 201 */ "duplicate default in switch", /* 202 */ "case label must be of type 'int' in traditional C", /* 203 */ @@ -296,7 +296,7 @@ static const char *const msgs[] = { "initialization of union is illegal in traditional C", /* 238 */ "constant argument to '!'", /* 239 */ "", /* unused */ /* 240 */ - "dubious operation on enum, op '%s'", /* 241 */ + "dubious operation '%s' on enum", /* 241 */ "combination of '%s' and '%s', op '%s'", /* 242 */ "dubious comparison of enums, op '%s'", /* 243 */ "illegal structure pointer combination", /* 244 */ @@ -310,7 +310,7 @@ static const char *const msgs[] = { "integer constant out of range", /* 252 */ "unterminated character constant", /* 253 */ "newline in string or char constant", /* 254 */ - "undefined or invalid # directive", /* 255 */ + "undefined or invalid '#' directive", /* 255 */ "unterminated comment", /* 256 */ "extra characters in lint comment", /* 257 */ "unterminated string constant", /* 258 */ @@ -338,13 +338,13 @@ static const char *const msgs[] = { "comment /* %s */ must be outside function", /* 280 */ "duplicate comment /* %s */", /* 281 */ "comment /* %s */ must precede function definition", /* 282 */ - "argument number mismatch with directive /* %s */", /* 283 */ + "argument number mismatch in comment /* %s */", /* 283 */ "fallthrough on default statement", /* 284 */ "prototype declaration", /* 285 */ "function definition is not a prototype", /* 286 */ "function declaration is not a prototype", /* 287 */ "dubious use of /* VARARGS */ with /* %s */", /* 288 */ - "can't be used together: /* PRINTFLIKE */ /* SCANFLIKE */", /* 289 */ + "/* PRINTFLIKE */ and /* SCANFLIKE */ cannot be combined", /* 289 */ "static function '%s' declared but not defined", /* 290 */ "invalid multibyte character", /* 291 */ "cannot concatenate wide and regular string literals", /* 292 */ @@ -367,7 +367,7 @@ static const char *const msgs[] = { "extra bits set to 0 in conversion of '%s' to '%s', op '%s'", /* 309 */ "symbol renaming can't be used on function arguments", /* 310 */ "symbol renaming can't be used on automatic variables", /* 311 */ - "%s does not support // comments", /* 312 */ + "%s does not support '//' comments", /* 312 */ "struct or union member name in initializer is a C99 feature",/* 313 */ "", /* never used */ /* 314 */ "GCC style struct or union member name in initializer", /* 315 */ @@ -375,7 +375,7 @@ static const char *const msgs[] = { "__func__ is a C99 feature", /* 317 */ "variable array dimension is a C99/GCC extension", /* 318 */ "compound literals are a C99/GCC extension", /* 319 */ - "({ }) is a GCC extension", /* 320 */ + "'({ ... })' is a GCC extension", /* 320 */ "array initializer with designators is a C99 feature", /* 321 */ "zero sized array is a C99 extension", /* 322 */ "continue in 'do ... while (0)' loop", /* 323 */ Index: src/usr.bin/xlint/lint1/func.c diff -u src/usr.bin/xlint/lint1/func.c:1.165 src/usr.bin/xlint/lint1/func.c:1.166 --- src/usr.bin/xlint/lint1/func.c:1.165 Mon Jul 3 10:23:12 2023 +++ src/usr.bin/xlint/lint1/func.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: func.c,v 1.165 2023/07/03 10:23:12 rillig Exp $ */ +/* $NetBSD: func.c,v 1.166 2023/07/09 11:01:27 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: func.c,v 1.165 2023/07/03 10:23:12 rillig Exp $"); +__RCSID("$NetBSD: func.c,v 1.166 2023/07/09 11:01:27 rillig Exp $"); #endif #include <stdlib.h> @@ -544,10 +544,10 @@ check_case_label(tnode_t *tn, control_st break; } if (cl != NULL && is_uinteger(nv.v_tspec)) { - /* duplicate case in switch: %lu */ + /* duplicate case '%lu' in switch */ error(200, (unsigned long)nv.u.integer); } else if (cl != NULL) { - /* duplicate case in switch: %ld */ + /* duplicate case '%ld' in switch */ error(199, (long)nv.u.integer); } else { check_getopt_case_label(nv.u.integer); Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.169 src/usr.bin/xlint/lint1/lex.c:1.170 --- src/usr.bin/xlint/lint1/lex.c:1.169 Sat Jul 8 10:59:38 2023 +++ src/usr.bin/xlint/lint1/lex.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.169 2023/07/08 10:59:38 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.170 2023/07/09 11:01:27 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: lex.c,v 1.169 2023/07/08 10:59:38 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.170 2023/07/09 11:01:27 rillig Exp $"); #endif #include <ctype.h> @@ -777,7 +777,7 @@ read_escaped_backslash(int delim) warning(264); return '\v'; case '8': case '9': - /* bad octal digit %c */ + /* bad octal digit '%c' */ warning(77, c); /* FALLTHROUGH */ case '0': case '1': case '2': case '3': @@ -988,7 +988,7 @@ lex_directive(const char *yytext) if (strncmp(cp, "pragma", 6) == 0 && ch_isspace(cp[6])) return; error: - /* undefined or invalid # directive */ + /* undefined or invalid '#' directive */ warning(255); return; } @@ -1151,7 +1151,7 @@ lex_slash_slash_comment(void) int c; if (!allow_c99 && !allow_gcc) - /* %s does not support // comments */ + /* %s does not support '//' comments */ gnuism(312, allow_c90 ? "C90" : "traditional C"); while ((c = read_byte()) != EOF && c != '\n') Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.555 src/usr.bin/xlint/lint1/tree.c:1.556 --- src/usr.bin/xlint/lint1/tree.c:1.555 Sun Jul 9 10:42:07 2023 +++ src/usr.bin/xlint/lint1/tree.c Sun Jul 9 11:01:27 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.555 2023/07/09 10:42:07 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.556 2023/07/09 11:01:27 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.555 2023/07/09 10:42:07 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.556 2023/07/09 11:01:27 rillig Exp $"); #endif #include <float.h> @@ -922,7 +922,7 @@ fold(tnode_t *tn) if (ovfl || ((uint64_t)(si | mask) != ~(uint64_t)0 && (si & ~mask) != 0)) { if (hflag) - /* integer overflow detected, op '%s' */ + /* operator '%s' produces integer overflow */ warning(141, op_name(tn->tn_op)); } @@ -1641,7 +1641,7 @@ fold_float(tnode_t *tn) */ fpe = 0; } else if (is_floating_overflow(t, v->u.floating)) { - /* floating point overflow on operator '%s' */ + /* operator '%s' produces floating point overflow */ warning(142, op_name(tn->tn_op)); v->u.floating = floating_error_value(t, v->u.floating); fpe = 0; @@ -3098,7 +3098,7 @@ check_bad_enum_operation(op_t op, const return; } - /* dubious operation on enum, op '%s' */ + /* dubious operation '%s' on enum */ warning(241, op_name(op)); } @@ -4837,7 +4837,7 @@ do_statement_expr(tnode_t *tn) : NULL; /* after a syntax error */ mem_block_level++; block_level++; - /* ({ }) is a GCC extension */ + /* '({ ... })' is a GCC extension */ gnuism(320); }