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: reword message about non-constant ...



details:   https://anonhg.NetBSD.org/src/rev/5a0e6759da65
branches:  trunk
changeset: 378126:5a0e6759da65
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jul 21 06:02:07 2023 +0000

description:
lint: reword message about non-constant initializer

diffstat:

 tests/usr.bin/xlint/lint1/init_braces.c |  4 ++--
 tests/usr.bin/xlint/lint1/msg_024.c     |  4 ++--
 tests/usr.bin/xlint/lint1/msg_181.c     |  8 ++++----
 tests/usr.bin/xlint/lint1/msg_319.c     |  4 ++--
 usr.bin/xlint/lint1/err.c               |  6 +++---
 usr.bin/xlint/lint1/init.c              |  8 ++++----
 6 files changed, 17 insertions(+), 17 deletions(-)

diffs (129 lines):

diff -r 3f3d3af63c9e -r 5a0e6759da65 tests/usr.bin/xlint/lint1/init_braces.c
--- a/tests/usr.bin/xlint/lint1/init_braces.c   Fri Jul 21 05:51:12 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/init_braces.c   Fri Jul 21 06:02:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_braces.c,v 1.8 2023/07/07 19:45:22 rillig Exp $   */
+/*     $NetBSD: init_braces.c,v 1.9 2023/07/21 06:02:07 rillig Exp $   */
 # 3 "init_braces.c"
 
 /*
@@ -16,7 +16,7 @@ init_int(void)
 {
        /* gcc-expect+4: error: invalid initializer */
        /* clang-expect+3: error: array initializer must be an initializer list */
-       /* expect+2: error: {}-enclosed initializer required [181] */
+       /* expect+2: error: {}-enclosed or constant initializer of type 'array[unknown_size] of int' required [181] */
        /* expect+1: error: empty array declaration for 'num0' [190] */
        int num0[] = 0;
        int num1[] = { 1 };
diff -r 3f3d3af63c9e -r 5a0e6759da65 tests/usr.bin/xlint/lint1/msg_024.c
--- a/tests/usr.bin/xlint/lint1/msg_024.c       Fri Jul 21 05:51:12 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_024.c       Fri Jul 21 06:02:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_024.c,v 1.5 2023/03/28 14:44:34 rillig Exp $       */
+/*     $NetBSD: msg_024.c,v 1.6 2023/07/21 06:02:07 rillig Exp $       */
 # 3 "msg_024.c"
 
 // Test for message: cannot initialize function '%s' [24]
@@ -14,5 +14,5 @@ definition(void)
 
 /* expect+3: error: cannot initialize function 'fn' [24] */
 /* The following message is strange but does not occur in practice. */
-/* expect+1: error: {}-enclosed initializer required [181] */
+/* expect+1: error: {}-enclosed or constant initializer of type 'function(void) returning void' required [181] */
 function fn = definition;
diff -r 3f3d3af63c9e -r 5a0e6759da65 tests/usr.bin/xlint/lint1/msg_181.c
--- a/tests/usr.bin/xlint/lint1/msg_181.c       Fri Jul 21 05:51:12 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_181.c       Fri Jul 21 06:02:07 2023 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: msg_181.c,v 1.6 2023/07/21 05:51:12 rillig Exp $       */
+/*     $NetBSD: msg_181.c,v 1.7 2023/07/21 06:02:07 rillig Exp $       */
 # 3 "msg_181.c"
 
-// Test for message: {}-enclosed initializer required [181]
+// Test for message: {}-enclosed or constant initializer of type '%s' required [181]
 
 /* lint1-extra-flags: -X 351 */
 
-/* expect+1: error: {}-enclosed initializer required [181] */
+/* expect+1: error: {}-enclosed or constant initializer of type 'struct <unnamed>' required [181] */
 struct { int x; } missing_braces = 3;
 struct { int x; } including_braces = { 3 };
 
@@ -20,4 +20,4 @@ struct number {
 } num = (struct number){
     .value = 3,
 };
-/* expect-1: error: {}-enclosed initializer required [181] */
+/* expect-1: error: {}-enclosed or constant initializer of type 'struct number' required [181] */
diff -r 3f3d3af63c9e -r 5a0e6759da65 tests/usr.bin/xlint/lint1/msg_319.c
--- a/tests/usr.bin/xlint/lint1/msg_319.c       Fri Jul 21 05:51:12 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_319.c       Fri Jul 21 06:02:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_319.c,v 1.5 2023/03/28 14:44:35 rillig Exp $       */
+/*     $NetBSD: msg_319.c,v 1.6 2023/07/21 06:02:07 rillig Exp $       */
 # 3 "msg_319.c"
 
 /* Test for message: compound literals are a C99/GCC extension [319] */
@@ -17,4 +17,4 @@ struct point {
        4,
 };
 /* expect-1: error: compound literals are a C99/GCC extension [319] */
-/* expect-2: error: {}-enclosed initializer required [181] */
+/* expect-2: error: {}-enclosed or constant initializer of type 'struct point' required [181] */
diff -r 3f3d3af63c9e -r 5a0e6759da65 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Fri Jul 21 05:51:12 2023 +0000
+++ b/usr.bin/xlint/lint1/err.c Fri Jul 21 06:02:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.212 2023/07/13 08:40:38 rillig Exp $ */
+/*     $NetBSD: err.c,v 1.213 2023/07/21 06:02:07 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.212 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.213 2023/07/21 06:02:07 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -236,7 +236,7 @@ static const char *const msgs[] = {
        "initializer does not fit",                                   /* 178 */
        "cannot initialize struct/union with no named member",        /* 179 */
        "bit-field initializer does not fit",                         /* 180 */
-       "{}-enclosed initializer required",                           /* 181 */
+       "{}-enclosed or constant initializer of type '%s' required",  /* 181 */
        "incompatible pointer types to '%s' and '%s'",                /* 182 */
        "illegal combination of %s '%s' and %s '%s'",                 /* 183 */
        "illegal combination of '%s' and '%s'",                       /* 184 */
diff -r 3f3d3af63c9e -r 5a0e6759da65 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Fri Jul 21 05:51:12 2023 +0000
+++ b/usr.bin/xlint/lint1/init.c        Fri Jul 21 06:02:07 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.248 2023/07/15 15:51:22 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.249 2023/07/21 06:02:07 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: init.c,v 1.248 2023/07/15 15:51:22 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.249 2023/07/21 06:02:07 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -976,8 +976,8 @@ initialization_expr(initialization *in, 
                goto done;
 
        if (bl == NULL && !is_scalar(tp->t_tspec)) {
-               /* {}-enclosed initializer required */
-               error(181);
+               /* {}-enclosed or constant initializer of type '%s' required */
+               error(181, type_name(in->in_sym->s_type));
                goto done;
        }
 



Home | Main Index | Thread Index | Old Index