Module Name: src Committed By: rillig Date: Sat Aug 26 10:43:53 UTC 2023
Modified Files: src/tests/usr.bin/xlint/lint1: c90.c msg_030.c msg_044.c msg_045.c msg_070.c msg_084.c msg_118.c msg_124.c msg_125.c msg_157.c msg_218.c msg_273.c msg_274.c msg_303.c msg_304.c msg_305.c parse_type_name.c src/usr.bin/xlint/lint1: cgram.y decl.c err.c lex.c lint1.h tree.c src/usr.bin/xlint/lint2: chk.c src/usr.bin/xlint/xlint: lint.1 Log Message: lint: make diagnostics about ANSI C more international To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/c90.c cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_030.c \ src/tests/usr.bin/xlint/lint1/msg_118.c cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_044.c \ src/tests/usr.bin/xlint/lint1/msg_045.c cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_070.c \ src/tests/usr.bin/xlint/lint1/msg_274.c \ src/tests/usr.bin/xlint/lint1/msg_303.c \ src/tests/usr.bin/xlint/lint1/msg_304.c \ src/tests/usr.bin/xlint/lint1/msg_305.c cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/xlint/lint1/msg_084.c \ src/tests/usr.bin/xlint/lint1/msg_125.c \ src/tests/usr.bin/xlint/lint1/msg_157.c cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_124.c cvs rdiff -u -r1.8 -r1.9 src/tests/usr.bin/xlint/lint1/msg_218.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_273.c cvs rdiff -u -r1.11 -r1.12 src/tests/usr.bin/xlint/lint1/parse_type_name.c cvs rdiff -u -r1.471 -r1.472 src/usr.bin/xlint/lint1/cgram.y cvs rdiff -u -r1.377 -r1.378 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.216 -r1.217 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.191 -r1.192 src/usr.bin/xlint/lint1/lex.c cvs rdiff -u -r1.199 -r1.200 src/usr.bin/xlint/lint1/lint1.h cvs rdiff -u -r1.577 -r1.578 src/usr.bin/xlint/lint1/tree.c cvs rdiff -u -r1.60 -r1.61 src/usr.bin/xlint/lint2/chk.c cvs rdiff -u -r1.63 -r1.64 src/usr.bin/xlint/xlint/lint.1 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/c90.c diff -u src/tests/usr.bin/xlint/lint1/c90.c:1.2 src/tests/usr.bin/xlint/lint1/c90.c:1.3 --- src/tests/usr.bin/xlint/lint1/c90.c:1.2 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/c90.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: c90.c,v 1.2 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: c90.c,v 1.3 2023/08/26 10:43:53 rillig Exp $ */ # 3 "c90.c" /* @@ -8,5 +8,5 @@ /* lint1-flags: -sw -X 351 */ -/* expect+1: error: ANSI C requires formal parameter before '...' [84] */ +/* expect+1: error: C90 to C17 require formal parameter before '...' [84] */ void varargs_function(...); Index: src/tests/usr.bin/xlint/lint1/msg_030.c diff -u src/tests/usr.bin/xlint/lint1/msg_030.c:1.7 src/tests/usr.bin/xlint/lint1/msg_030.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_030.c:1.7 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_030.c Sat Aug 26 10:43:53 2023 @@ -1,23 +1,23 @@ -/* $NetBSD: msg_030.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_030.c,v 1.8 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_030.c" -/* Test for message: redeclaration of '%s'; ANSI C requires static [30] */ +/* Test for message: redeclaration of '%s'; C90 or later require static [30] */ /* lint1-flags: -sw -X 351 */ /* expect+1: error: old-style declaration; add 'int' [1] */ static a; -/* expect+1: warning: redeclaration of 'a'; ANSI C requires static [30] */ +/* expect+1: warning: redeclaration of 'a'; C90 or later require static [30] */ int a; /* expect+1: error: old-style declaration; add 'int' [1] */ static b; -/* expect+1: warning: redeclaration of 'b'; ANSI C requires static [30] */ +/* expect+1: warning: redeclaration of 'b'; C90 or later require static [30] */ int b = 1; /* expect+1: error: old-style declaration; add 'int' [1] */ static c = 1; -/* expect+1: warning: redeclaration of 'c'; ANSI C requires static [30] */ +/* expect+1: warning: redeclaration of 'c'; C90 or later require static [30] */ int c; void Index: src/tests/usr.bin/xlint/lint1/msg_118.c diff -u src/tests/usr.bin/xlint/lint1/msg_118.c:1.7 src/tests/usr.bin/xlint/lint1/msg_118.c:1.8 --- src/tests/usr.bin/xlint/lint1/msg_118.c:1.7 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_118.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_118.c,v 1.7 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_118.c,v 1.8 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_118.c" -/* Test for message: semantics of '%s' change in ANSI C; use explicit cast [118] */ +/* Test for message: semantics of '%s' change in C90; use explicit cast [118] */ /* lint1-flags: -hw -X 351 */ @@ -14,7 +14,7 @@ int_shl_uint(int left, unsigned int righ int int_shr_uint(int left, unsigned int right) { - /* expect+1: warning: semantics of '>>' change in ANSI C; use explicit cast [118] */ + /* expect+1: warning: semantics of '>>' change in C90; use explicit cast [118] */ return left >> right; } Index: src/tests/usr.bin/xlint/lint1/msg_044.c diff -u src/tests/usr.bin/xlint/lint1/msg_044.c:1.6 src/tests/usr.bin/xlint/lint1/msg_044.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_044.c:1.6 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_044.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_044.c,v 1.6 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_044.c,v 1.7 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_044.c" -// Test for message: declaration of '%s %s' introduces new type in ANSI C [44] +// Test for message: declaration of '%s %s' introduces new type in C90 or later [44] /* lint1-extra-flags: -X 351 */ @@ -11,7 +11,7 @@ struct tag; void declaration(struct tag *); void definition(void) { - /* expect+2: warning: declaration of 'struct tag' introduces new type in ANSI C [44] */ + /* expect+2: warning: declaration of 'struct tag' introduces new type in C90 or later [44] */ /* expect+1: warning: struct 'tag' never defined [233] */ struct tag; } Index: src/tests/usr.bin/xlint/lint1/msg_045.c diff -u src/tests/usr.bin/xlint/lint1/msg_045.c:1.6 src/tests/usr.bin/xlint/lint1/msg_045.c:1.7 --- src/tests/usr.bin/xlint/lint1/msg_045.c:1.6 Mon Jun 20 21:13:36 2022 +++ src/tests/usr.bin/xlint/lint1/msg_045.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_045.c,v 1.6 2022/06/20 21:13:36 rillig Exp $ */ +/* $NetBSD: msg_045.c,v 1.7 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_045.c" /* Test for message: base type is really '%s %s' [45] */ @@ -12,7 +12,7 @@ struct counter { function() { /* expect+4: warning: base type is really 'struct counter' [45] */ - /* expect+3: warning: declaration of 'union counter' introduces new type in ANSI C [44] */ + /* expect+3: warning: declaration of 'union counter' introduces new type in C90 or later [44] */ /* expect+2: error: 'counter' has incomplete type 'incomplete union counter' [31] */ /* expect+1: warning: union 'counter' never defined [234] */ union counter counter; Index: src/tests/usr.bin/xlint/lint1/msg_070.c diff -u src/tests/usr.bin/xlint/lint1/msg_070.c:1.4 src/tests/usr.bin/xlint/lint1/msg_070.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_070.c:1.4 Tue Mar 28 14:44:34 2023 +++ src/tests/usr.bin/xlint/lint1/msg_070.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_070.c,v 1.4 2023/03/28 14:44:34 rillig Exp $ */ +/* $NetBSD: msg_070.c,v 1.5 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_070.c" -// Test for message: %soperand of '%s' is unsigned in ANSI C [70] +// Test for message: %soperand of '%s' is unsigned in C90 [70] /* This message is not used. */ typedef int dummy; Index: src/tests/usr.bin/xlint/lint1/msg_274.c diff -u src/tests/usr.bin/xlint/lint1/msg_274.c:1.4 src/tests/usr.bin/xlint/lint1/msg_274.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_274.c:1.4 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_274.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_274.c,v 1.4 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_274.c,v 1.5 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_274.c" -/* Test for message: ANSI C forbids comparison of %s with %s [274] */ +/* Test for message: C90 or later forbid comparison of %s with %s [274] */ /* lint1-flags: -sw -X 351 */ @@ -17,7 +17,7 @@ example(void (*function_pointer)(void), if (function_pointer == (const void *)0) return; - /* expect+1: warning: ANSI C forbids comparison of function pointer with 'void *' [274] */ + /* expect+1: warning: C90 or later forbid comparison of function pointer with 'void *' [274] */ if (function_pointer == void_pointer) return; } Index: src/tests/usr.bin/xlint/lint1/msg_303.c diff -u src/tests/usr.bin/xlint/lint1/msg_303.c:1.4 src/tests/usr.bin/xlint/lint1/msg_303.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_303.c:1.4 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_303.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_303.c,v 1.4 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_303.c,v 1.5 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_303.c" -/* Test for message: ANSI C forbids conversion of %s to %s [303] */ +/* Test for message: conversion of %s to %s requires a cast [303] */ /* lint1-flags: -sw -X 351 */ @@ -10,12 +10,12 @@ void take_void_pointer(void *); void * to_void_pointer(void) { - /* expect+1: warning: ANSI C forbids conversion of function pointer to 'void *' [303] */ + /* expect+1: warning: conversion of function pointer to 'void *' requires a cast [303] */ return to_void_pointer; } void (*to_function_pointer(void *arg))(void) { - /* expect+1: warning: ANSI C forbids conversion of 'void *' to function pointer [303] */ + /* expect+1: warning: conversion of 'void *' to function pointer requires a cast [303] */ return arg; } Index: src/tests/usr.bin/xlint/lint1/msg_304.c diff -u src/tests/usr.bin/xlint/lint1/msg_304.c:1.4 src/tests/usr.bin/xlint/lint1/msg_304.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_304.c:1.4 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_304.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_304.c,v 1.4 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_304.c,v 1.5 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_304.c" -/* Test for message: ANSI C forbids conversion of %s to %s, arg #%d [304] */ +/* Test for message: conversion of %s to %s requires a cast, arg #%d [304] */ /* lint1-flags: -sw -X 351 */ @@ -11,9 +11,9 @@ void take_function_pointer(void (*)(void void caller(void *arg) { - /* expect+1: warning: ANSI C forbids conversion of function pointer to 'void *', arg #1 [304] */ + /* expect+1: warning: conversion of function pointer to 'void *' requires a cast, arg #1 [304] */ take_void_pointer(caller); - /* expect+1: warning: ANSI C forbids conversion of 'void *' to function pointer, arg #1 [304] */ + /* expect+1: warning: conversion of 'void *' to function pointer requires a cast, arg #1 [304] */ take_function_pointer(arg); } Index: src/tests/usr.bin/xlint/lint1/msg_305.c diff -u src/tests/usr.bin/xlint/lint1/msg_305.c:1.4 src/tests/usr.bin/xlint/lint1/msg_305.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_305.c:1.4 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_305.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_305.c,v 1.4 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_305.c,v 1.5 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_305.c" -/* Test for message: ANSI C forbids conversion of %s to %s, op %s [305] */ +/* Test for message: conversion of %s to %s requires a cast, op %s [305] */ /* lint1-flags: -sw -X 351 */ @@ -12,9 +12,9 @@ typedef void (*function)(void); void caller(void **void_pointer, function *function_pointer) { - /* expect+1: warning: ANSI C forbids conversion of function pointer to 'void *', op = [305] */ + /* expect+1: warning: conversion of function pointer to 'void *' requires a cast, op = [305] */ *void_pointer = *function_pointer; - /* expect+1: warning: ANSI C forbids conversion of 'void *' to function pointer, op = [305] */ + /* expect+1: warning: conversion of 'void *' to function pointer requires a cast, op = [305] */ *function_pointer = *void_pointer; } Index: src/tests/usr.bin/xlint/lint1/msg_084.c diff -u src/tests/usr.bin/xlint/lint1/msg_084.c:1.5 src/tests/usr.bin/xlint/lint1/msg_084.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_084.c:1.5 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_084.c Sat Aug 26 10:43:53 2023 @@ -1,11 +1,11 @@ -/* $NetBSD: msg_084.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_084.c,v 1.6 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_084.c" -/* Test for message: ANSI C requires formal parameter before '...' [84] */ +/* Test for message: C90 to C17 require formal parameter before '...' [84] */ /* lint1-flags: -sw -X 351 */ -/* expect+2: error: ANSI C requires formal parameter before '...' [84] */ +/* expect+2: error: C90 to C17 require formal parameter before '...' [84] */ void only_ellipsis(...) { Index: src/tests/usr.bin/xlint/lint1/msg_125.c diff -u src/tests/usr.bin/xlint/lint1/msg_125.c:1.5 src/tests/usr.bin/xlint/lint1/msg_125.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_125.c:1.5 Fri Jul 7 19:45:22 2023 +++ src/tests/usr.bin/xlint/lint1/msg_125.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_125.c,v 1.5 2023/07/07 19:45:22 rillig Exp $ */ +/* $NetBSD: msg_125.c,v 1.6 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_125.c" -// Test for message: ANSI C forbids ordered comparisons of pointers to functions [125] +// Test for message: pointers to functions can only be compared for equality [125] /* lint1-extra-flags: -s -X 351 */ @@ -10,6 +10,6 @@ typedef void (*action)(void); int less(action a, action b) { - /* expect+1: warning: ANSI C forbids ordered comparisons of pointers to functions [125] */ + /* expect+1: warning: pointers to functions can only be compared for equality [125] */ return a < b; } Index: src/tests/usr.bin/xlint/lint1/msg_157.c diff -u src/tests/usr.bin/xlint/lint1/msg_157.c:1.5 src/tests/usr.bin/xlint/lint1/msg_157.c:1.6 --- src/tests/usr.bin/xlint/lint1/msg_157.c:1.5 Tue Mar 28 14:44:35 2023 +++ src/tests/usr.bin/xlint/lint1/msg_157.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_157.c,v 1.5 2023/03/28 14:44:35 rillig Exp $ */ +/* $NetBSD: msg_157.c,v 1.6 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_157.c" -/* Test for message: ANSI C treats constant as unsigned [157] */ +/* Test for message: C90 treats constant as unsigned [157] */ /* lint1-flags: -w -X 351 */ @@ -9,5 +9,5 @@ * A rather strange definition for an ARGB color. * Luckily, 'double' has more than 32 significant binary digits. */ -/* expect+1: warning: ANSI C treats constant as unsigned [157] */ +/* expect+1: warning: C90 treats constant as unsigned [157] */ double white = 0xFFFFFFFF; Index: src/tests/usr.bin/xlint/lint1/msg_124.c diff -u src/tests/usr.bin/xlint/lint1/msg_124.c:1.14 src/tests/usr.bin/xlint/lint1/msg_124.c:1.15 --- src/tests/usr.bin/xlint/lint1/msg_124.c:1.14 Fri Jul 7 06:03:31 2023 +++ src/tests/usr.bin/xlint/lint1/msg_124.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_124.c,v 1.14 2023/07/07 06:03:31 rillig Exp $ */ +/* $NetBSD: msg_124.c,v 1.15 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_124.c" // Test for message: illegal combination of '%s' and '%s', op '%s' [124] @@ -32,7 +32,7 @@ compare_pointers(const void *vp, const c { ok(vp == cp); ok(vp == ip); - /* expect+1: warning: ANSI C forbids comparison of 'void *' with function pointer [274] */ + /* expect+1: warning: C90 or later forbid comparison of 'void *' with function pointer [274] */ ok(vp == fp); /* expect+1: warning: illegal combination of 'pointer to const char' and 'pointer to const int', op '==' [124] */ not_ok(cp == ip); Index: src/tests/usr.bin/xlint/lint1/msg_218.c diff -u src/tests/usr.bin/xlint/lint1/msg_218.c:1.8 src/tests/usr.bin/xlint/lint1/msg_218.c:1.9 --- src/tests/usr.bin/xlint/lint1/msg_218.c:1.8 Sat Jul 8 11:03:00 2023 +++ src/tests/usr.bin/xlint/lint1/msg_218.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_218.c,v 1.8 2023/07/08 11:03:00 rillig Exp $ */ +/* $NetBSD: msg_218.c,v 1.9 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_218.c" -/* Test for message: ANSI C treats constant as unsigned, op '%s' [218] */ +/* Test for message: C90 treats constant as unsigned, op '%s' [218] */ /* lint1-only-if: ilp32 */ /* lint1-flags: -w -X 351 */ @@ -20,7 +20,7 @@ void sink_int(int); void test_signed_int(void) { - /* expect+2: warning: ANSI C treats constant as unsigned, op '-' [218] */ + /* expect+2: warning: C90 treats constant as unsigned, op '-' [218] */ /* expect+1: warning: conversion of 'unsigned long' to 'int' is out of range, arg #1 [295] */ sink_int(-2147483648); } @@ -40,20 +40,20 @@ test_signed_int(void) void compare_large_constant(void) { - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = s32 < 3000000000L; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < s32; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = u32 < 3000000000L; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < u32; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = s64 < 3000000000L; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < s64; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = u64 < 3000000000L; - /* expect+1: warning: ANSI C treats constant as unsigned, op '<' [218] */ + /* expect+1: warning: C90 treats constant as unsigned, op '<' [218] */ cond = 3000000000L < u64; } Index: src/tests/usr.bin/xlint/lint1/msg_273.c diff -u src/tests/usr.bin/xlint/lint1/msg_273.c:1.3 src/tests/usr.bin/xlint/lint1/msg_273.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_273.c:1.3 Sun Aug 22 13:45:56 2021 +++ src/tests/usr.bin/xlint/lint1/msg_273.c Sat Aug 26 10:43:53 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_273.c,v 1.3 2021/08/22 13:45:56 rillig Exp $ */ +/* $NetBSD: msg_273.c,v 1.4 2023/08/26 10:43:53 rillig Exp $ */ # 3 "msg_273.c" -/* Test for message: bit-field type '%s' invalid in ANSI C [273] */ +/* Test for message: bit-field type '%s' invalid in C90 or later [273] */ /* lint1-flags: -sw */ @@ -9,6 +9,6 @@ struct bit_fields { int plain_int: 3; unsigned int unsigned_int: 3; signed int signed_int: 3; - /* expect+1: warning: bit-field type 'unsigned char' invalid in ANSI C [273] */ + /* expect+1: warning: bit-field type 'unsigned char' invalid in C90 or later [273] */ unsigned char unsigned_char: 3; }; Index: src/tests/usr.bin/xlint/lint1/parse_type_name.c diff -u src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.11 src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.12 --- src/tests/usr.bin/xlint/lint1/parse_type_name.c:1.11 Wed Aug 2 21:11:35 2023 +++ src/tests/usr.bin/xlint/lint1/parse_type_name.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: parse_type_name.c,v 1.11 2023/08/02 21:11:35 rillig Exp $ */ +/* $NetBSD: parse_type_name.c,v 1.12 2023/08/26 10:43:53 rillig Exp $ */ # 3 "parse_type_name.c" /* @@ -141,7 +141,7 @@ cover_vararg_parameter_type_list(void) sink(sizeof(void (*)(double, ...))); /* cover 'T_ELLIPSIS' */ - /* expect+1: warning: ANSI C requires formal parameter before '...' [84] */ + /* expect+1: warning: C90 to C17 require formal parameter before '...' [84] */ sink(sizeof(void (*)(...))); } Index: src/usr.bin/xlint/lint1/cgram.y diff -u src/usr.bin/xlint/lint1/cgram.y:1.471 src/usr.bin/xlint/lint1/cgram.y:1.472 --- src/usr.bin/xlint/lint1/cgram.y:1.471 Sat Aug 12 18:05:51 2023 +++ src/usr.bin/xlint/lint1/cgram.y Sat Aug 26 10:43:53 2023 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: cgram.y,v 1.471 2023/08/12 18:05:51 rillig Exp $ */ +/* $NetBSD: cgram.y,v 1.472 2023/08/26 10:43:53 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: cgram.y,v 1.471 2023/08/12 18:05:51 rillig Exp $"); +__RCSID("$NetBSD: cgram.y,v 1.472 2023/08/26 10:43:53 rillig Exp $"); #endif #include <limits.h> @@ -1572,10 +1572,10 @@ vararg_parameter_type_list: /* specific | T_ELLIPSIS { /* TODO: C99 6.7.5 makes this an error as well. */ if (!allow_trad && !allow_c99) { - /* ANSI C requires formal parameter before '...' */ + /* C90 to C17 require formal parameter before '...' */ error(84); } else if (allow_c90) { - /* ANSI C requires formal parameter before '...' */ + /* C90 to C17 require formal parameter before '...' */ warning(84); } $$ = (struct parameter_list){ .vararg = true }; Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.377 src/usr.bin/xlint/lint1/decl.c:1.378 --- src/usr.bin/xlint/lint1/decl.c:1.377 Wed Aug 2 21:58:11 2023 +++ src/usr.bin/xlint/lint1/decl.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.377 2023/08/02 21:58:11 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.378 2023/08/26 10:43:53 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.377 2023/08/02 21:58:11 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.378 2023/08/26 10:43:53 rillig Exp $"); #endif #include <sys/param.h> @@ -954,7 +954,7 @@ check_bit_field_type(sym_t *dsym, type_t if (!allow_trad && !allow_c99) { type_t *btp = block_dup_type(tp); btp->t_bitfield = false; - /* bit-field type '%s' invalid in ANSI C */ + /* bit-field type '%s' invalid in C90 or ... */ warning(273, type_name(btp)); } else if (pflag) { type_t *btp = block_dup_type(tp); @@ -2123,7 +2123,7 @@ check_redeclaration(sym_t *dsym, bool *d */ /* TODO: Make this an error in C99 mode as well. */ if (!allow_trad && !allow_c99) { - /* redeclaration of '%s'; ANSI C requires static */ + /* redeclaration of '%s'; C90 or later require static */ warning(30, dsym->s_name); print_previous_declaration(rdsym); } Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.216 src/usr.bin/xlint/lint1/err.c:1.217 --- src/usr.bin/xlint/lint1/err.c:1.216 Thu Aug 3 18:48:42 2023 +++ src/usr.bin/xlint/lint1/err.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.216 2023/08/03 18:48:42 rillig Exp $ */ +/* $NetBSD: err.c,v 1.217 2023/08/26 10:43:53 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.216 2023/08/03 18:48:42 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.217 2023/08/26 10:43:53 rillig Exp $"); #endif #include <limits.h> @@ -85,7 +85,7 @@ static const char *const msgs[] = { "redeclaration of '%s'", /* 27 */ "redefinition of '%s'", /* 28 */ "'%s' was previously declared extern, becomes static", /* 29 */ - "redeclaration of '%s'; ANSI C requires static", /* 30 */ + "redeclaration of '%s'; C90 or later require static", /* 30 */ "'%s' has incomplete type '%s'", /* 31 */ "type of parameter '%s' defaults to 'int'", /* 32 */ "duplicate member name '%s'", /* 33 */ @@ -99,7 +99,7 @@ static const char *const msgs[] = { "bit-field in union is very unusual", /* 41 */ "forward reference to enum type", /* 42 */ "redefinition of '%s' hides earlier one", /* 43 */ - "declaration of '%s %s' introduces new type in ANSI C", /* 44 */ + "declaration of '%s %s' introduces new type in C90 or later", /* 44 */ "base type is really '%s %s'", /* 45 */ "%s tag '%s' redeclared as %s", /* 46 */ "zero sized %s is a C99 feature", /* 47 */ @@ -139,7 +139,7 @@ static const char *const msgs[] = { "\\a undefined in traditional C", /* 81 */ "\\x undefined in traditional C", /* 82 */ "storage class after type is obsolescent", /* 83 */ - "ANSI C requires formal parameter before '...'", /* 84 */ + "C90 to C17 require formal parameter before '...'", /* 84 */ "dubious tag declaration '%s %s'", /* 85 */ "automatic '%s' hides external declaration", /* 86 */ "static '%s' hides external declaration", /* 87 */ @@ -173,14 +173,14 @@ static const char *const msgs[] = { "%soperand of '%s' must be modifiable lvalue", /* 115 */ "illegal pointer subtraction", /* 116 */ "bitwise '%s' on signed value possibly nonportable", /* 117 */ - "semantics of '%s' change in ANSI C; use explicit cast", /* 118 */ + "semantics of '%s' change in C90; use explicit cast", /* 118 */ "conversion of '%s' to '%s' is out of range", /* 119 */ "bitwise '%s' on signed value nonportable", /* 120 */ "negative shift", /* 121 */ "shift amount %llu is greater than bit-size %llu of '%s'", /* 122 */ "illegal combination of %s '%s' and %s '%s', op '%s'", /* 123 */ "illegal combination of '%s' and '%s', op '%s'", /* 124 */ - "ANSI C forbids ordered comparisons of pointers to functions",/* 125 */ + "pointers to functions can only be compared for equality", /* 125 */ "incompatible types '%s' and '%s' in conditional", /* 126 */ "'&' before array or function: ignored", /* 127 */ "operands of '%s' have incompatible pointer types to '%s' and '%s'", /* 128 */ @@ -212,7 +212,7 @@ static const char *const msgs[] = { "illegal combination of %s '%s' and %s '%s', arg #%d", /* 154 */ "passing '%s' to incompatible '%s', arg #%d", /* 155 */ "function expects '%s', passing '%s' for arg #%d", /* 156 */ - "ANSI C treats constant as unsigned", /* 157 */ + "C90 treats constant as unsigned", /* 157 */ "'%s' may be used before set", /* 158 */ "assignment in conditional context", /* 159 */ "operator '==' found where '=' was expected", /* 160 */ @@ -273,7 +273,7 @@ static const char *const msgs[] = { "function '%s' implicitly declared to return int", /* 215 */ "function '%s' has 'return expr' and 'return'", /* 216 */ "function '%s' falls off bottom without returning value", /* 217 */ - "ANSI C treats constant as unsigned, op '%s'", /* 218 */ + "C90 treats constant as unsigned, op '%s'", /* 218 */ "concatenated strings are illegal in traditional C", /* 219 */ "fallthrough on case statement", /* 220 */ "initialization of unsigned with negative constant", /* 221 */ @@ -328,8 +328,8 @@ static const char *const msgs[] = { "function prototypes are illegal in traditional C", /* 270 */ "switch expression must be of type 'int' in traditional C", /* 271 */ "empty translation unit", /* 272 */ - "bit-field type '%s' invalid in ANSI C", /* 273 */ - "ANSI C forbids comparison of %s with %s", /* 274 */ + "bit-field type '%s' invalid in C90 or later", /* 273 */ + "C90 or later forbid comparison of %s with %s", /* 274 */ "cast discards 'const' from type '%s'", /* 275 */ "'__%s__' is illegal for type '%s'", /* 276 */ "initialization of '%s' with '%s'", /* 277 */ @@ -358,9 +358,9 @@ static const char *const msgs[] = { "old-style definition", /* 300 */ "array of incomplete type", /* 301 */ "'%s' returns pointer to automatic object", /* 302 */ - "ANSI C forbids conversion of %s to %s", /* 303 */ - "ANSI C forbids conversion of %s to %s, arg #%d", /* 304 */ - "ANSI C forbids conversion of %s to %s, op %s", /* 305 */ + "conversion of %s to %s requires a cast", /* 303 */ + "conversion of %s to %s requires a cast, arg #%d", /* 304 */ + "conversion of %s to %s requires a cast, op %s", /* 305 */ "constant truncated by conversion, op '%s'", /* 306 */ "static variable '%s' set but not used", /* 307 */ "invalid type for _Complex", /* 308 */ Index: src/usr.bin/xlint/lint1/lex.c diff -u src/usr.bin/xlint/lint1/lex.c:1.191 src/usr.bin/xlint/lint1/lex.c:1.192 --- src/usr.bin/xlint/lint1/lex.c:1.191 Sat Aug 12 06:43:16 2023 +++ src/usr.bin/xlint/lint1/lex.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lex.c,v 1.191 2023/08/12 06:43:16 rillig Exp $ */ +/* $NetBSD: lex.c,v 1.192 2023/08/26 10:43:53 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.191 2023/08/12 06:43:16 rillig Exp $"); +__RCSID("$NetBSD: lex.c,v 1.192 2023/08/26 10:43:53 rillig Exp $"); #endif #include <ctype.h> @@ -572,7 +572,7 @@ lex_integer_constant(const char *yytext, } else if (allow_trad) { /* * Remember that the constant is unsigned - * only in ANSI C. + * only in C90. */ ansiu = true; } Index: src/usr.bin/xlint/lint1/lint1.h diff -u src/usr.bin/xlint/lint1/lint1.h:1.199 src/usr.bin/xlint/lint1/lint1.h:1.200 --- src/usr.bin/xlint/lint1/lint1.h:1.199 Wed Aug 2 18:51:25 2023 +++ src/usr.bin/xlint/lint1/lint1.h Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: lint1.h,v 1.199 2023/08/02 18:51:25 rillig Exp $ */ +/* $NetBSD: lint1.h,v 1.200 2023/08/26 10:43:53 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -85,9 +85,11 @@ typedef struct strg { } strg_t; // TODO: Use bit-fields instead of plain bool, but keep an eye on arm and -// powerpc, on which GCC 10.5.0 generates code that leads to extra 327 -// warnings, even in msg_327.c, which does not contain any type qualifier at -// all. A possible starting point for continuing the investigation is that +// powerpc, on which NetBSD's GCC 10.5.0 (but not the upstream GCC) generates +// code that leads to extra 327 warnings, even in msg_327.c, which does not +// contain any type qualifier at all. +// +// A possible starting point for continuing the investigation is that // type_qualifiers is a very small struct that contains only bool bit-fields, // and this struct is a member of the parser's union. // Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.577 src/usr.bin/xlint/lint1/tree.c:1.578 --- src/usr.bin/xlint/lint1/tree.c:1.577 Tue Aug 8 20:15:10 2023 +++ src/usr.bin/xlint/lint1/tree.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.577 2023/08/08 20:15:10 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.578 2023/08/26 10:43:53 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.577 2023/08/08 20:15:10 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.578 2023/08/26 10:43:53 rillig Exp $"); #endif #include <float.h> @@ -1346,7 +1346,7 @@ build_assignment(op_t op, bool sys, tnod if (op == SHLASS && hflag && allow_trad && allow_c90 && portable_rank_cmp(lt, rt) < 0) - /* semantics of '%s' change in ANSI C; ... */ + /* semantics of '%s' change in C90; ... */ warning(118, "<<="); if (op != SHLASS && op != SHRASS @@ -1683,17 +1683,17 @@ build_binary(tnode_t *ln, op_t op, bool /* * If the result of the operation is different for signed or * unsigned operands and one of the operands is signed only in - * ANSI C, print a warning. + * C90, print a warning. */ if (mp->m_warn_if_left_unsigned_in_c90 && ln->tn_op == CON && ln->tn_val.v_unsigned_since_c90) { - /* ANSI C treats constant as unsigned, op '%s' */ + /* C90 treats constant as unsigned, op '%s' */ warning(218, op_name(op)); ln->tn_val.v_unsigned_since_c90 = false; } if (mp->m_warn_if_right_unsigned_in_c90 && rn->tn_op == CON && rn->tn_val.v_unsigned_since_c90) { - /* ANSI C treats constant as unsigned, op '%s' */ + /* C90 treats constant as unsigned, op '%s' */ warning(218, op_name(op)); rn->tn_val.v_unsigned_since_c90 = false; } @@ -2071,7 +2071,7 @@ before_conversion(const tnode_t *tn) } /* - * Most errors required by ANSI C are reported in struct_or_union_member(). + * Most errors required by C90 are reported in struct_or_union_member(). * Here we only check for totally wrong things. */ static bool @@ -2270,7 +2270,7 @@ typeok_shr(op_t op, !is_uinteger(olt) && is_uinteger(ort)) { /* The left operand would become unsigned in traditional C. */ if (hflag && (ln->tn_op != CON || ln->tn_val.u.integer < 0)) { - /* semantics of '%s' change in ANSI C; use ... */ + /* semantics of '%s' change in C90; use ... */ warning(118, op_name(op)); } } else if (allow_trad && allow_c90 && @@ -2281,7 +2281,7 @@ typeok_shr(op_t op, * (possibly sign-extended) and then shifted. */ if (hflag && (ln->tn_op != CON || ln->tn_val.u.integer < 0)) { - /* semantics of '%s' change in ANSI C; use ... */ + /* semantics of '%s' change in C90; use ... */ warning(118, op_name(op)); } } @@ -2302,10 +2302,10 @@ typeok_shl(op_t op, tspec_t lt, tspec_t /* * XXX If both operands are constant, make sure * that there is really a difference between - * ANSI C and traditional C. + * C90 and traditional C. */ if (hflag && allow_trad && allow_c90) - /* semantics of '%s' change in ANSI C; use ... */ + /* semantics of '%s' change in C90; use ... */ warning(118, op_name(op)); } } @@ -2388,7 +2388,7 @@ check_pointer_comparison(op_t op, const const char *lsts, *rsts; *(lst == FUNC ? &lsts : &rsts) = "function pointer"; *(lst == VOID ? &lsts : &rsts) = "'void *'"; - /* ANSI C forbids comparison of %s with %s */ + /* C90 or later forbid comparison of %s with %s */ warning(274, lsts, rsts); } return; @@ -2402,7 +2402,7 @@ check_pointer_comparison(op_t op, const if (lst == FUNC && rst == FUNC) { /* TODO: C99 behaves like C90 here, see C99 6.5.8p2. */ if ((!allow_trad && !allow_c99) && op != EQ && op != NE) - /* ANSI C forbids ordered comparisons of ... */ + /* pointers to functions can only be compared ... */ warning(125); } } @@ -2456,7 +2456,7 @@ typeok_colon_pointer(const type_t *ltp, /* (void *)0 is handled in typeok_colon */ /* TODO: C99 behaves like C90 here. */ if (!allow_trad && !allow_c99) - /* ANSI C forbids conversion of %s to %s, op %s */ + /* conversion of %s to %s requires a cast, op %s */ warning(305, "function pointer", "'void *'", op_name(COLON)); return; @@ -2615,15 +2615,15 @@ check_assign_void_pointer(op_t op, int a switch (op) { case INIT: case RETURN: - /* ANSI C forbids conversion of %s to %s */ + /* conversion of %s to %s requires a cast */ warning(303, rts, lts); break; case FARG: - /* ANSI C forbids conversion of %s to %s, arg #%d */ + /* conversion of %s to %s requires a cast, arg #%d */ warning(304, rts, lts, arg); break; default: - /* ANSI C forbids conversion of %s to %s, op %s */ + /* conversion of %s to %s requires a cast, op %s */ warning(305, rts, lts, op_name(op)); break; } @@ -3576,7 +3576,7 @@ convert_pointer_from_pointer(type_t *ntp /* null pointers are already handled in convert() */ *(nst == FUNC ? &nts : &ots) = "function pointer"; *(nst == VOID ? &nts : &ots) = "'void *'"; - /* ANSI C forbids conversion of %s to %s */ + /* conversion of %s to %s requires a cast */ warning(303, ots, nts); } return; @@ -3943,7 +3943,7 @@ convert_constant(op_t op, int arg, const (is_floating(nt) || ( (is_integer(nt) && !is_uinteger(nt) && portable_rank_cmp(nt, ot) > 0)))) { - /* ANSI C treats constant as unsigned */ + /* C90 treats constant as unsigned */ warning(157); v->v_unsigned_since_c90 = false; } Index: src/usr.bin/xlint/lint2/chk.c diff -u src/usr.bin/xlint/lint2/chk.c:1.60 src/usr.bin/xlint/lint2/chk.c:1.61 --- src/usr.bin/xlint/lint2/chk.c:1.60 Thu Jul 13 08:40:38 2023 +++ src/usr.bin/xlint/lint2/chk.c Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: chk.c,v 1.60 2023/07/13 08:40:38 rillig Exp $ */ +/* $NetBSD: chk.c,v 1.61 2023/08/26 10:43:53 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) -__RCSID("$NetBSD: chk.c,v 1.60 2023/07/13 08:40:38 rillig Exp $"); +__RCSID("$NetBSD: chk.c,v 1.61 2023/08/26 10:43:53 rillig Exp $"); #endif #include <ctype.h> @@ -205,7 +205,7 @@ check_multiple_definitions(const hte_t * def1 = NULL; for (sym = hte->h_syms; sym != NULL; sym = sym->s_next) { /* - * ANSI C allows tentative definitions of the same name in + * C90 allows tentative definitions of the same name in * only one compilation unit. */ if (sym->s_def != DEF && (!sflag || sym->s_def != TDEF)) @@ -921,7 +921,7 @@ scanflike(const hte_t *hte, fcall_t *cal goto conv; } else if (fc == 'X') { /* - * XXX valid in ANSI C, but in NetBSD's libc imple- + * XXX valid in C90, but in NetBSD's libc imple- * mented as "lx". That's why it should be avoided. */ if (sz != NO_TSPEC || !tflag) @@ -930,7 +930,7 @@ scanflike(const hte_t *hte, fcall_t *cal goto conv; } else if (fc == 'E') { /* - * XXX valid in ANSI C, but in NetBSD's libc imple- + * XXX valid in C90, but in NetBSD's libc imple- * mented as "lf". That's why it should be avoided. */ if (sz != NO_TSPEC || !tflag) @@ -945,7 +945,7 @@ scanflike(const hte_t *hte, fcall_t *cal goto conv; } else if (fc == 'G') { /* - * XXX valid in ANSI C, but in NetBSD's libc not + * XXX valid in C90, but in NetBSD's libc not * implemented */ if (sz != NO_TSPEC && sz != LONG && sz != LDOUBLE) Index: src/usr.bin/xlint/xlint/lint.1 diff -u src/usr.bin/xlint/xlint/lint.1:1.63 src/usr.bin/xlint/xlint/lint.1:1.64 --- src/usr.bin/xlint/xlint/lint.1:1.63 Wed Aug 2 18:51:25 2023 +++ src/usr.bin/xlint/xlint/lint.1 Sat Aug 26 10:43:53 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: lint.1,v 1.63 2023/08/02 18:51:25 rillig Exp $ +.\" $NetBSD: lint.1,v 1.64 2023/08/26 10:43:53 rillig Exp $ .\" .\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. .\" Copyright (c) 1994, 1995 Jochen Pohl @@ -372,7 +372,7 @@ In case of redeclarations, report the po C99 mode. Currently not fully implemented. .It Fl s -Strict ANSI C89/ISO C90 mode. +Strict ISO C90 mode. Issue warnings and errors required by ISO C90, as opposed to traditional C. Also do not produce warnings for constructs which behave differently in traditional C and ISO C90. @@ -391,7 +391,7 @@ Traditional C mode. is not predefined in this mode. Warnings are printed for constructs not allowed in traditional C. Warnings for constructs which behave differently in traditional C -and ANSI C are suppressed. +and C90 are suppressed. Preprocessor macros describing the machine type (e.g. .Li sun3 ) and machine architecture (e.g.