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: fix wrong check for enum constants...



details:   https://anonhg.NetBSD.org/src/rev/859b8479511a
branches:  trunk
changeset: 1022197:859b8479511a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 08 18:53:57 2021 +0000

description:
lint: fix wrong check for enum constants in switch (since today)

diffstat:

 tests/usr.bin/xlint/lint1/msg_206.c   |  3 +--
 tests/usr.bin/xlint/lint1/msg_206.exp |  1 -
 usr.bin/xlint/lint1/cgram.y           |  7 +++----
 3 files changed, 4 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 3e57b5bf4c77 -r 859b8479511a tests/usr.bin/xlint/lint1/msg_206.c
--- a/tests/usr.bin/xlint/lint1/msg_206.c       Thu Jul 08 18:50:57 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_206.c       Thu Jul 08 18:53:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_206.c,v 1.3 2021/07/08 18:50:57 rillig Exp $       */
+/*     $NetBSD: msg_206.c,v 1.4 2021/07/08 18:53:57 rillig Exp $       */
 # 3 "msg_206.c"
 
 // Test for message: enumeration value(s) not handled in switch [206]
@@ -25,5 +25,4 @@
        case THREE:
                break;
        }
-       /* FIXME *//* expect-1: warning: enumeration value(s) not handled in switch [206] */
 }
diff -r 3e57b5bf4c77 -r 859b8479511a tests/usr.bin/xlint/lint1/msg_206.exp
--- a/tests/usr.bin/xlint/lint1/msg_206.exp     Thu Jul 08 18:50:57 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_206.exp     Thu Jul 08 18:53:57 2021 +0000
@@ -1,2 +1,1 @@
 msg_206.c(19): warning: enumeration value(s) not handled in switch [206]
-msg_206.c(27): warning: enumeration value(s) not handled in switch [206]
diff -r 3e57b5bf4c77 -r 859b8479511a usr.bin/xlint/lint1/cgram.y
--- a/usr.bin/xlint/lint1/cgram.y       Thu Jul 08 18:50:57 2021 +0000
+++ b/usr.bin/xlint/lint1/cgram.y       Thu Jul 08 18:53:57 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.272 2021/07/08 18:50:57 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.273 2021/07/08 18:53:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.272 2021/07/08 18:50:57 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.273 2021/07/08 18:53:57 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -853,8 +853,7 @@
                symtyp = FVFT;
                enumval = 0;
          } enumerator_list enumerator_list_comma_opt T_RBRACE {
-               /* FIXME: $2 must be $3 */
-               $$ = $2;
+               $$ = $3;
          }
        ;
 



Home | Main Index | Thread Index | Old Index