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: update wording in diagnostic for C99



details:   https://anonhg.NetBSD.org/src/rev/045eebbba5b2
branches:  trunk
changeset: 377445:045eebbba5b2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jul 11 20:54:23 2023 +0000

description:
lint: update wording in diagnostic for C99

diffstat:

 tests/usr.bin/xlint/lint1/decl_enum_c90.c |   4 ++--
 tests/usr.bin/xlint/lint1/msg_054.c       |   6 +++---
 usr.bin/xlint/lint1/cgram.y               |   8 ++++----
 usr.bin/xlint/lint1/err.c                 |   6 +++---
 usr.bin/xlint/lint1/lint1.h               |  20 +++++++++++++-------
 5 files changed, 25 insertions(+), 19 deletions(-)

diffs (127 lines):

diff -r 7d890be03fab -r 045eebbba5b2 tests/usr.bin/xlint/lint1/decl_enum_c90.c
--- a/tests/usr.bin/xlint/lint1/decl_enum_c90.c Tue Jul 11 18:13:27 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/decl_enum_c90.c Tue Jul 11 20:54:23 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: decl_enum_c90.c,v 1.2 2022/06/17 18:54:53 rillig Exp $ */
+/*     $NetBSD: decl_enum_c90.c,v 1.3 2023/07/11 20:54:23 rillig Exp $ */
 # 3 "decl_enum_c90.c"
 
 /*
@@ -10,4 +10,4 @@
 enum {
        A,
 };
-/* expect-1: error: trailing ',' prohibited in enum declaration [54] */
+/* expect-1: error: trailing ',' in enum declaration requires C99 or later [54] */
diff -r 7d890be03fab -r 045eebbba5b2 tests/usr.bin/xlint/lint1/msg_054.c
--- a/tests/usr.bin/xlint/lint1/msg_054.c       Tue Jul 11 18:13:27 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_054.c       Tue Jul 11 20:54:23 2023 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: msg_054.c,v 1.4 2022/04/16 09:22:25 rillig Exp $       */
+/*     $NetBSD: msg_054.c,v 1.5 2023/07/11 20:54:23 rillig Exp $       */
 # 3 "msg_054.c"
 
-/* Test for message: trailing ',' prohibited in enum declaration [54] */
+/* Test for message: trailing ',' in enum declaration requires C99 or later [54] */
 
 /* lint1-flags: -sw */
 
@@ -10,4 +10,4 @@ enum color {
        GREEN,
        BLUE,
 };
-/* expect-1: error: trailing ',' prohibited in enum declaration [54] */
+/* expect-1: error: trailing ',' in enum declaration requires C99 or later [54] */
diff -r 7d890be03fab -r 045eebbba5b2 usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Tue Jul 11 18:13:27 2023 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Tue Jul 11 20:54:23 2023 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.452 2023/07/10 19:58:47 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.453 2023/07/11 20:54:23 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.452 2023/07/10 19:58:47 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.453 2023/07/11 20:54:23 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -1166,10 +1166,10 @@ enums_with_opt_comma:           /* helper for C99
          enumerator_list
        | enumerator_list T_COMMA {
                if (!allow_c99 && !allow_trad) {
-                       /* trailing ',' prohibited in enum declaration */
+                       /* trailing ',' in enum declaration requires C99 ... */
                        error(54);
                } else {
-                       /* trailing ',' prohibited in enum declaration */
+                       /* trailing ',' in enum declaration requires C99 ... */
                        c99ism(54);
                }
                $$ = $1;
diff -r 7d890be03fab -r 045eebbba5b2 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Tue Jul 11 18:13:27 2023 +0000
+++ b/usr.bin/xlint/lint1/err.c Tue Jul 11 20:54:23 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.210 2023/07/10 19:58:47 rillig Exp $ */
+/*     $NetBSD: err.c,v 1.211 2023/07/11 20:54:23 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.210 2023/07/10 19:58:47 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.211 2023/07/11 20:54:23 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -109,7 +109,7 @@ static const char *const msgs[] = {
        "parameter mismatch: %d declared, %d defined",                /* 51 */
        "cannot initialize parameter '%s'",                           /* 52 */
        "declared argument '%s' is missing",                          /* 53 */
-       "trailing ',' prohibited in enum declaration",                /* 54 */
+       "trailing ',' in enum declaration requires C99 or later",     /* 54 */
        "integral constant expression expected",                      /* 55 */
        "integral constant too large",                                /* 56 */
        "enumeration constant '%s' hides parameter",                  /* 57 */
diff -r 7d890be03fab -r 045eebbba5b2 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Tue Jul 11 18:13:27 2023 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Tue Jul 11 20:54:23 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.184 2023/07/10 19:47:12 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.185 2023/07/11 20:54:23 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -487,12 +487,18 @@ check_printf(const char *fmt, ...)
                /* LINTED 129 */                                        \
        })
 
-#  define error(msgid, args...) wrap_check_printf(error, true, msgid, ##args)
-#  define warning(msgid, args...) wrap_check_printf(warning, true, msgid, ##args)
-#  define gnuism(msgid, args...) wrap_check_printf(gnuism, !allow_gcc || (!allow_trad && !allow_c99), msgid, ##args)
-#  define c99ism(msgid, args...) wrap_check_printf(c99ism, !allow_c99 && (!allow_gcc || !allow_trad), msgid, ##args)
-#  define c11ism(msgid, args...) wrap_check_printf(c11ism, !allow_c11 && !allow_gcc, msgid, ##args)
-#  define c23ism(msgid, args...) wrap_check_printf(c23ism, !allow_c23, msgid, ##args)
+#  define error(msgid, args...) wrap_check_printf(error, \
+    true, msgid, ##args)
+#  define warning(msgid, args...) wrap_check_printf(warning, \
+    true, msgid, ##args)
+#  define gnuism(msgid, args...) wrap_check_printf(gnuism, \
+    !allow_gcc || (!allow_trad && !allow_c99), msgid, ##args)
+#  define c99ism(msgid, args...) wrap_check_printf(c99ism, \
+    !allow_c99 && (!allow_gcc || !allow_trad), msgid, ##args)
+#  define c11ism(msgid, args...) wrap_check_printf(c11ism, \
+    !allow_c11 && !allow_gcc, msgid, ##args)
+#  define c23ism(msgid, args...) wrap_check_printf(c23ism, \
+    !allow_c23, msgid, ##args)
 #endif
 
 #ifdef DEBUG



Home | Main Index | Thread Index | Old Index