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: remove unused message for struct w...



details:   https://anonhg.NetBSD.org/src/rev/ac9608240e31
branches:  trunk
changeset: 985476:ac9608240e31
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 27 19:50:44 2021 +0000

description:
lint: remove unused message for struct without named members

Lint has not produced this message since the rewrite of the
initializations in March 2021.  Structures that consist of only unnamed
bit-fields probably don't occur in practice.

diffstat:

 tests/usr.bin/xlint/lint1/msg_179.c   |  23 ++++++++++++++++++++---
 tests/usr.bin/xlint/lint1/msg_179.exp |   2 +-
 usr.bin/xlint/lint1/err.c             |   6 +++---
 3 files changed, 24 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r 51b931b1689c -r ac9608240e31 tests/usr.bin/xlint/lint1/msg_179.c
--- a/tests/usr.bin/xlint/lint1/msg_179.c       Fri Aug 27 18:40:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_179.c       Fri Aug 27 19:50:44 2021 +0000
@@ -1,7 +1,24 @@
-/*     $NetBSD: msg_179.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_179.c,v 1.3 2021/08/27 19:50:44 rillig Exp $       */
 # 3 "msg_179.c"
 
 // Test for message: cannot initialize struct/union with no named member [179]
+/* This message is not used. */
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+struct {
+       unsigned int :0;
+} no_named_member = {
+       /* no named member, therefore no initializer expression */
+};
+
+struct {
+       /* no members */
+} empty = {
+       /* no initializer expressions */
+};
+
+struct {
+       unsigned int: 0;
+} no_named_member_init = {
+       /* expect+1: error: too many struct/union initializers [172] */
+       3,
+};
diff -r 51b931b1689c -r ac9608240e31 tests/usr.bin/xlint/lint1/msg_179.exp
--- a/tests/usr.bin/xlint/lint1/msg_179.exp     Fri Aug 27 18:40:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_179.exp     Fri Aug 27 19:50:44 2021 +0000
@@ -1,1 +1,1 @@
-msg_179.c(6): error: syntax error ':' [249]
+msg_179.c(23): error: too many struct/union initializers [172]
diff -r 51b931b1689c -r ac9608240e31 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Fri Aug 27 18:40:28 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Fri Aug 27 19:50:44 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.139 2021/08/23 06:50:01 rillig Exp $ */
+/*     $NetBSD: err.c,v 1.140 2021/08/27 19:50:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.139 2021/08/23 06:50:01 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.140 2021/08/27 19:50:44 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -233,7 +233,7 @@
        "",                     /* no longer used */                  /* 176 */
        "non-constant initializer",                                   /* 177 */
        "initializer does not fit",                                   /* 178 */
-       "cannot initialize struct/union with no named member",        /* 179 */
+       "",                     /* unused since 2021-03-29 */         /* 179 */
        "bit-field initializer does not fit",                         /* 180 */
        "{}-enclosed initializer required",                           /* 181 */
        "incompatible pointer types (%s != %s)",                      /* 182 */



Home | Main Index | Thread Index | Old Index