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: add quotes around placeholders for...



details:   https://anonhg.NetBSD.org/src/rev/1133189795cc
branches:  trunk
changeset: 366730:1133189795cc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 11 12:23:59 2022 +0000

description:
lint: add quotes around placeholders for a few more messages

diffstat:

 tests/usr.bin/xlint/lint1/msg_013.c   |   6 +++---
 tests/usr.bin/xlint/lint1/msg_013.exp |   2 +-
 tests/usr.bin/xlint/lint1/msg_021.c   |  24 ++++++++++++++++--------
 tests/usr.bin/xlint/lint1/msg_021.exp |  12 ++++++------
 tests/usr.bin/xlint/lint1/msg_027.c   |   6 +++---
 tests/usr.bin/xlint/lint1/msg_027.exp |   2 +-
 tests/usr.bin/xlint/lint1/msg_030.c   |  10 +++++-----
 tests/usr.bin/xlint/lint1/msg_030.exp |   6 +++---
 tests/usr.bin/xlint/lint1/msg_237.c   |  14 ++++++++++----
 tests/usr.bin/xlint/lint1/msg_237.exp |   2 +-
 usr.bin/xlint/lint1/decl.c            |  31 +++++++++++++++----------------
 usr.bin/xlint/lint1/err.c             |  14 +++++++-------
 usr.bin/xlint/lint1/func.c            |   8 ++++----
 13 files changed, 75 insertions(+), 62 deletions(-)

diffs (truncated from 419 to 300 lines):

diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_013.c
--- a/tests/usr.bin/xlint/lint1/msg_013.c       Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_013.c       Sat Jun 11 12:23:59 2022 +0000
@@ -1,12 +1,12 @@
-/*     $NetBSD: msg_013.c,v 1.3 2021/08/26 19:23:25 rillig Exp $       */
+/*     $NetBSD: msg_013.c,v 1.4 2022/06/11 12:24:00 rillig Exp $       */
 # 3 "msg_013.c"
 
-// Test for message: incomplete enum type: %s [13]
+// Test for message: incomplete enum type '%s' [13]
 
 enum tag;
 
 /* XXX: why '<unnamed>'? */
-/* expect+1: warning: incomplete enum type: <unnamed> [13] */
+/* expect+1: warning: incomplete enum type '<unnamed>' [13] */
 void function(enum tag);
 
 enum tag {
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_013.exp
--- a/tests/usr.bin/xlint/lint1/msg_013.exp     Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_013.exp     Sat Jun 11 12:23:59 2022 +0000
@@ -1,1 +1,1 @@
-msg_013.c(10): warning: incomplete enum type: <unnamed> [13]
+msg_013.c(10): warning: incomplete enum type '<unnamed>' [13]
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_021.c
--- a/tests/usr.bin/xlint/lint1/msg_021.c       Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_021.c       Sat Jun 11 12:23:59 2022 +0000
@@ -1,31 +1,38 @@
-/*     $NetBSD: msg_021.c,v 1.2 2021/01/31 09:48:47 rillig Exp $       */
+/*     $NetBSD: msg_021.c,v 1.3 2022/06/11 12:24:00 rillig Exp $       */
 # 3 "msg_021.c"
 
-// Test for message: redeclaration of formal parameter %s [21]
+// Test for message: redeclaration of formal parameter '%s' [21]
+
+/* See also message 237, which has the same text. */
 
 /*ARGSUSED*/
 void
-old_style_with_duplicate_parameter(parameter, parameter) /* expect: 21 */
+/* expect+1: error: redeclaration of formal parameter 'parameter' [21] */
+old_style_with_duplicate_parameter(parameter, parameter)
     int parameter;
-{                              /* expect: 32 */
+{
+       /* expect-1: warning: argument type defaults to 'int': parameter [32] */
 }
 
 void
 old_style_with_duplicate_parameter_declaration(parameter)
     int parameter;
-    int parameter;             /* expect: 237 */
+    /* expect+1: error: redeclaration of formal parameter 'parameter' [237] */
+    int parameter;
 {
 }
 
 void old_style_with_local_variable(parameter)
     int parameter;
 {
-       int parameter;          /* expect: 27 */
+       /* expect+1: error: redeclaration of 'parameter' [27] */
+       int parameter;
 }
 
 /*ARGSUSED*/
 void
-prototype_with_duplicate_parameter(int param, int param) /* expect: 237 */
+/* expect+1: error: redeclaration of formal parameter 'param' [237] */
+prototype_with_duplicate_parameter(int param, int param)
 {
 
 }
@@ -33,5 +40,6 @@
 void
 prototype_with_local_variable(int parameter)
 {
-       int parameter;          /* expect: 27 */
+       /* expect+1: error: redeclaration of 'parameter' [27] */
+       int parameter;
 }
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_021.exp
--- a/tests/usr.bin/xlint/lint1/msg_021.exp     Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_021.exp     Sat Jun 11 12:23:59 2022 +0000
@@ -1,6 +1,6 @@
-msg_021.c(8): error: redeclaration of formal parameter parameter [21]
-msg_021.c(10): warning: argument type defaults to 'int': parameter [32]
-msg_021.c(16): error: redeclaration of formal parameter parameter [237]
-msg_021.c(23): error: redeclaration of parameter [27]
-msg_021.c(28): error: redeclaration of formal parameter param [237]
-msg_021.c(36): error: redeclaration of parameter [27]
+msg_021.c(11): error: redeclaration of formal parameter 'parameter' [21]
+msg_021.c(13): warning: argument type defaults to 'int': parameter [32]
+msg_021.c(21): error: redeclaration of formal parameter 'parameter' [237]
+msg_021.c(29): error: redeclaration of 'parameter' [27]
+msg_021.c(35): error: redeclaration of formal parameter 'param' [237]
+msg_021.c(44): error: redeclaration of 'parameter' [27]
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_027.c
--- a/tests/usr.bin/xlint/lint1/msg_027.c       Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_027.c       Sat Jun 11 12:23:59 2022 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: msg_027.c,v 1.6 2022/04/05 23:09:19 rillig Exp $       */
+/*     $NetBSD: msg_027.c,v 1.7 2022/06/11 12:24:00 rillig Exp $       */
 # 3 "msg_027.c"
 
-// Test for message: redeclaration of %s [27]
+// Test for message: redeclaration of '%s' [27]
 
 extern int identifier(void);
 
@@ -10,7 +10,7 @@
 
 enum {
        constant,
-       /* expect+1: error: redeclaration of constant [27] */
+       /* expect+1: error: redeclaration of 'constant' [27] */
        constant,
        next
 };
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_027.exp
--- a/tests/usr.bin/xlint/lint1/msg_027.exp     Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_027.exp     Sat Jun 11 12:23:59 2022 +0000
@@ -1,2 +1,2 @@
 msg_027.c(9): error: redeclaration of 'identifier' with type 'function(void) returning double', expected 'function(void) returning int' [347]
-msg_027.c(14): error: redeclaration of constant [27]
+msg_027.c(14): error: redeclaration of 'constant' [27]
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_030.c
--- a/tests/usr.bin/xlint/lint1/msg_030.c       Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_030.c       Sat Jun 11 12:23:59 2022 +0000
@@ -1,23 +1,23 @@
-/*     $NetBSD: msg_030.c,v 1.4 2022/04/24 19:21:01 rillig Exp $       */
+/*     $NetBSD: msg_030.c,v 1.5 2022/06/11 12:24:00 rillig Exp $       */
 # 3 "msg_030.c"
 
-/* Test for message: redeclaration of %s; ANSI C requires static [30] */
+/* Test for message: redeclaration of '%s'; ANSI C requires static [30] */
 
 /* lint1-flags: -sw */
 
 /* 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'; ANSI C requires 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'; ANSI C requires 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'; ANSI C requires static [30] */
 int c;
 
 void
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_030.exp
--- a/tests/usr.bin/xlint/lint1/msg_030.exp     Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_030.exp     Sat Jun 11 12:23:59 2022 +0000
@@ -1,6 +1,6 @@
 msg_030.c(9): error: old style declaration; add 'int' [1]
-msg_030.c(11): warning: redeclaration of a; ANSI C requires static [30]
+msg_030.c(11): warning: redeclaration of 'a'; ANSI C requires static [30]
 msg_030.c(14): error: old style declaration; add 'int' [1]
-msg_030.c(16): warning: redeclaration of b; ANSI C requires static [30]
+msg_030.c(16): warning: redeclaration of 'b'; ANSI C requires static [30]
 msg_030.c(19): error: old style declaration; add 'int' [1]
-msg_030.c(21): warning: redeclaration of c; ANSI C requires static [30]
+msg_030.c(21): warning: redeclaration of 'c'; ANSI C requires static [30]
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_237.c
--- a/tests/usr.bin/xlint/lint1/msg_237.c       Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_237.c       Sat Jun 11 12:23:59 2022 +0000
@@ -1,7 +1,13 @@
-/*     $NetBSD: msg_237.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_237.c,v 1.3 2022/06/11 12:24:00 rillig Exp $       */
 # 3 "msg_237.c"
 
-// Test for message: redeclaration of formal parameter %s [237]
+// Test for message: redeclaration of formal parameter '%s' [237]
+
+/* See also message 21, which has the same text. */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/*ARGSUSED*/
+void
+/* expect+1: error: redeclaration of formal parameter 'param' [237] */
+prototype_with_duplicate_parameter(int param, int param)
+{
+}
diff -r 609184e6877e -r 1133189795cc tests/usr.bin/xlint/lint1/msg_237.exp
--- a/tests/usr.bin/xlint/lint1/msg_237.exp     Sat Jun 11 11:52:13 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_237.exp     Sat Jun 11 12:23:59 2022 +0000
@@ -1,1 +1,1 @@
-msg_237.c(6): error: syntax error ':' [249]
+msg_237.c(11): error: redeclaration of formal parameter 'param' [237]
diff -r 609184e6877e -r 1133189795cc usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Jun 11 11:52:13 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Jun 11 12:23:59 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.284 2022/06/11 11:52:13 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.285 2022/06/11 12:23:59 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.284 2022/06/11 11:52:13 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.285 2022/06/11 12:23:59 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -869,7 +869,7 @@
                break;
        case ENUM:
                if (is_incomplete(tp) && name != NULL) {
-                       /* incomplete enum type: %s */
+                       /* incomplete enum type '%s' */
                        warning(13, name);
                }
                /* FALLTHROUGH */
@@ -1659,7 +1659,7 @@
 
        if (sym->s_scl != NOSCL) {
                if (block_level == sym->s_block_level) {
-                       /* redeclaration of formal parameter %s */
+                       /* redeclaration of formal parameter '%s' */
                        error(21, sym->s_name);
                        lint_assert(sym->s_defarg);
                }
@@ -1908,7 +1908,7 @@
                                /* enumeration constant hides parameter: %s */
                                warning(57, sym->s_name);
                        } else {
-                               /* redeclaration of %s */
+                               /* redeclaration of '%s' */
                                error(27, sym->s_name);
                                /*
                                 * inside blocks it should not be too
@@ -2011,10 +2011,10 @@
                        if (dowarn) {
                                /* TODO: Make this an error in C99 mode as well. */
                                if (!allow_trad && !allow_c99)
-                                       /* redeclaration of %s */
+                                       /* redeclaration of '%s' */
                                        error(27, dsym->s_name);
                                else
-                                       /* redeclaration of %s */
+                                       /* redeclaration of '%s' */
                                        warning(27, dsym->s_name);
                                print_previous_declaration(-1, rdsym);
                        }
@@ -2120,7 +2120,7 @@
 
        rsym = dcs->d_redeclared_symbol;
        if (rsym->s_scl == ENUM_CONST) {
-               /* redeclaration of %s */
+               /* redeclaration of '%s' */
                error(27, dsym->s_name);
                print_previous_declaration(-1, rsym);
                return true;
@@ -2132,7 +2132,7 @@
                return true;
        }
        if (dsym->s_scl == TYPEDEF) {
-               /* redeclaration of %s */
+               /* redeclaration of '%s' */
                error(27, dsym->s_name);
                print_previous_declaration(-1, rsym);
                return true;
@@ -2161,7 +2161,7 @@
                 * All cases except "int a = 1; static int a;" are caught
                 * above with or without a warning
                 */
-               /* redeclaration of %s */
+               /* redeclaration of '%s' */
                error(27, dsym->s_name);
                print_previous_declaration(-1, rsym);
                return true;
@@ -2176,10 +2176,9 @@
         * Now it's one of:
         * "static a; int a;", "static a; int a = 1;", "static a = 1; int a;"
         */
-       /* redeclaration of %s; ANSI C requires "static" */
        /* 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'; ANSI C requires static */
                warning(30, dsym->s_name);
                print_previous_declaration(-1, rsym);
        }
@@ -2456,7 +2455,7 @@
 
        if (dcs->d_redeclared_symbol != NULL &&
            dcs->d_redeclared_symbol->s_block_level == block_level) {



Home | Main Index | Thread Index | Old Index