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: accept keyword variant FALL THROUG...



details:   https://anonhg.NetBSD.org/src/rev/f0831128108e
branches:  trunk
changeset: 985519:f0831128108e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 29 09:05:35 2021 +0000

description:
lint: accept keyword variant FALL THROUGH as alias to FALLTHROUGH

Seen in archive_string.c, macro WRITE_UC.

No documentation change since the canonical spelling of this keyword
stays the same.

diffstat:

 tests/usr.bin/xlint/lint1/msg_220.c   |   4 ++--
 tests/usr.bin/xlint/lint1/msg_220.exp |   1 -
 usr.bin/xlint/lint1/lex.c             |  10 +++++++---
 3 files changed, 9 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r 65651530510d -r f0831128108e tests/usr.bin/xlint/lint1/msg_220.c
--- a/tests/usr.bin/xlint/lint1/msg_220.c       Sun Aug 29 09:02:01 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_220.c       Sun Aug 29 09:05:35 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_220.c,v 1.4 2021/08/29 08:57:50 rillig Exp $       */
+/*     $NetBSD: msg_220.c,v 1.5 2021/08/29 09:05:35 rillig Exp $       */
 # 3 "msg_220.c"
 
 // Test for message: fallthrough on case statement [220]
@@ -53,7 +53,7 @@
        case 1:
                println("1");
                /* FALL THROUGH */
-               /* expect+1: warning: fallthrough on case statement [220] */
+               /* Lint warned before 2021-08-29. */
        case 2:
                println("2");
                /* FALLS THROUGH */
diff -r 65651530510d -r f0831128108e tests/usr.bin/xlint/lint1/msg_220.exp
--- a/tests/usr.bin/xlint/lint1/msg_220.exp     Sun Aug 29 09:02:01 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_220.exp     Sun Aug 29 09:05:35 2021 +0000
@@ -1,6 +1,5 @@
 msg_220.c(19): warning: fallthrough on case statement [220]
 msg_220.c(22): warning: fallthrough on default statement [284]
-msg_220.c(57): warning: fallthrough on case statement [220]
 msg_220.c(61): warning: fallthrough on case statement [220]
 msg_220.c(65): warning: fallthrough on case statement [220]
 msg_220.c(69): warning: fallthrough on case statement [220]
diff -r 65651530510d -r f0831128108e usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sun Aug 29 09:02:01 2021 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sun Aug 29 09:05:35 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.78 2021/08/28 21:52:14 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.79 2021/08/29 09:05:35 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: lex.c,v 1.78 2021/08/28 21:52:14 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.79 2021/08/29 09:05:35 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1120,6 +1120,7 @@
                { "CONSTANTCONDITION",  false,  constcond       },
                { "FALLTHRU",           false,  fallthru        },
                { "FALLTHROUGH",        false,  fallthru        },
+               { "FALL THROUGH",       false,  fallthru        },
                { "LINTLIBRARY",        false,  lintlib         },
                { "LINTED",             true,   linted          },
                { "LONGLONG",           false,  longlong        },
@@ -1144,10 +1145,13 @@
 
        /* Read the potential keyword to keywd */
        l = 0;
-       while (c != EOF && isupper(c) && l < sizeof(keywd) - 1) {
+       while (c != EOF && l < sizeof(keywd) - 1 &&
+           (isupper(c) || isspace(c))) {
                keywd[l++] = (char)c;
                c = inpc();
        }
+       while (l > 0 && ch_isspace(keywd[l - 1]))
+               l--;
        keywd[l] = '\0';
 
        /* look for the keyword */



Home | Main Index | Thread Index | Old Index