Module Name: src
Committed By: rillig
Date: Sun Aug 29 09:05:35 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_220.c msg_220.exp
src/usr.bin/xlint/lint1: lex.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_220.c
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_220.exp
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/xlint/lint1/lex.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/msg_220.c
diff -u src/tests/usr.bin/xlint/lint1/msg_220.c:1.4 src/tests/usr.bin/xlint/lint1/msg_220.c:1.5
--- src/tests/usr.bin/xlint/lint1/msg_220.c:1.4 Sun Aug 29 08:57:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_220.c Sun Aug 29 09:05:35 2021
@@ -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 @@ annotation_comment_variations(int n)
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 */
Index: src/tests/usr.bin/xlint/lint1/msg_220.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_220.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_220.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_220.exp:1.3 Sun Aug 29 08:57:50 2021
+++ src/tests/usr.bin/xlint/lint1/msg_220.exp Sun Aug 29 09:05:35 2021
@@ -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]
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.78 src/usr.bin/xlint/lint1/lex.c:1.79
--- src/usr.bin/xlint/lint1/lex.c:1.78 Sat Aug 28 21:52:14 2021
+++ src/usr.bin/xlint/lint1/lex.c Sun Aug 29 09:05:35 2021
@@ -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 @@ lex_comment(void)
{ "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 @@ lex_comment(void)
/* 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 */