Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 lint: clean up the wording of a few diag...
details: https://anonhg.NetBSD.org/src/rev/5d52602bf314
branches: trunk
changeset: 377370:5d52602bf314
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 09 11:01:27 2023 +0000
description:
lint: clean up the wording of a few diagnostics
diffstat:
tests/usr.bin/xlint/lint1/d_c99_init.c | 4 +-
tests/usr.bin/xlint/lint1/decl_arg.c | 6 +-
tests/usr.bin/xlint/lint1/expr_fold.c | 32 ++++++++--------
tests/usr.bin/xlint/lint1/msg_009.c | 12 +++---
tests/usr.bin/xlint/lint1/msg_077.c | 6 +-
tests/usr.bin/xlint/lint1/msg_141.c | 12 +++---
tests/usr.bin/xlint/lint1/msg_142.c | 8 ++--
tests/usr.bin/xlint/lint1/msg_199.c | 19 +++++++--
tests/usr.bin/xlint/lint1/msg_200.c | 6 +-
tests/usr.bin/xlint/lint1/msg_241.c | 68 +++++++++++++++++-----------------
tests/usr.bin/xlint/lint1/msg_242.c | 4 +-
tests/usr.bin/xlint/lint1/msg_255.c | 6 +-
tests/usr.bin/xlint/lint1/msg_257.c | 4 +-
tests/usr.bin/xlint/lint1/msg_283.c | 6 +-
tests/usr.bin/xlint/lint1/msg_289.c | 6 +-
tests/usr.bin/xlint/lint1/msg_312.c | 6 +-
tests/usr.bin/xlint/lint1/msg_320.c | 6 +-
usr.bin/xlint/lint1/decl.c | 16 ++++----
usr.bin/xlint/lint1/err.c | 28 +++++++-------
usr.bin/xlint/lint1/func.c | 8 ++--
usr.bin/xlint/lint1/lex.c | 10 ++--
usr.bin/xlint/lint1/tree.c | 12 +++---
22 files changed, 147 insertions(+), 138 deletions(-)
diffs (truncated from 871 to 300 lines):
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c Sun Jul 09 11:01:27 2023 +0000
@@ -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:
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/decl_arg.c
--- a/tests/usr.bin/xlint/lint1/decl_arg.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_arg.c Sun Jul 09 11:01:27 2023 +0000
@@ -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 */
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/expr_fold.c
--- a/tests/usr.bin/xlint/lint1/expr_fold.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/expr_fold.c Sun Jul 09 11:01:27 2023 +0000
@@ -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;
}
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/msg_009.c
--- a/tests/usr.bin/xlint/lint1/msg_009.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_009.c Sun Jul 09 11:01:27 2023 +0000
@@ -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);
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/msg_077.c
--- a/tests/usr.bin/xlint/lint1/msg_077.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_077.c Sun Jul 09 11:01:27 2023 +0000
@@ -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';
/*
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/msg_141.c
--- a/tests/usr.bin/xlint/lint1/msg_141.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_141.c Sun Jul 09 11:01:27 2023 +0000
@@ -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);
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/msg_142.c
--- a/tests/usr.bin/xlint/lint1/msg_142.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_142.c Sun Jul 09 11:01:27 2023 +0000
@@ -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;
/*
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/msg_199.c
--- a/tests/usr.bin/xlint/lint1/msg_199.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_199.c Sun Jul 09 11:01:27 2023 +0000
@@ -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]
+
+/* lint1-extra-flags: -X 351 */
-/* 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."
+void
+example(int x)
+{
+ switch (x) {
+ case 3:
+ /* expect+1: error: duplicate case '3' in switch [199] */
+ case 3:
+ break;
+ }
+}
diff -r 9f485d436520 -r 5d52602bf314 tests/usr.bin/xlint/lint1/msg_200.c
--- a/tests/usr.bin/xlint/lint1/msg_200.c Sun Jul 09 10:42:07 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_200.c Sun Jul 09 11:01:27 2023 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index