Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: demonstrate wrong warn...
details: https://anonhg.NetBSD.org/src/rev/2743f8c7b27b
branches: trunk
changeset: 1023083:2743f8c7b27b
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 22 22:09:57 2021 +0000
description:
tests/lint: demonstrate wrong warning for '?' in getopt
diffstat:
tests/usr.bin/xlint/lint1/msg_338.c | 27 ++++++++++++++++++++++++++-
tests/usr.bin/xlint/lint1/msg_338.exp | 1 +
2 files changed, 27 insertions(+), 1 deletions(-)
diffs (46 lines):
diff -r 7ddc3ad289ea -r 2743f8c7b27b tests/usr.bin/xlint/lint1/msg_338.c
--- a/tests/usr.bin/xlint/lint1/msg_338.c Sun Aug 22 21:27:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_338.c Sun Aug 22 22:09:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_338.c,v 1.3 2021/04/05 01:35:34 rillig Exp $ */
+/* $NetBSD: msg_338.c,v 1.4 2021/08/22 22:09:57 rillig Exp $ */
# 3 "msg_338.c"
// Test for message: option '%c' should be handled in the switch [338]
@@ -51,3 +51,28 @@
return 0;
}
+
+void usage(void);
+
+/* Seen in usr.bin/ftp/main.c 1.127 from 2020-07-18. */
+int
+question_option(int argc, char **argv)
+{
+ int c;
+
+ /* FIXME */
+ /* expect+1: warning: option '?' should be handled in the switch [338] */
+ while ((c = getopt(argc, argv, "?x")) != -1) {
+ switch (c) {
+ case 'x':
+ break;
+ case '?':
+ usage();
+ return 0;
+ default:
+ usage();
+ return 1;
+ }
+ }
+ return 0;
+}
diff -r 7ddc3ad289ea -r 2743f8c7b27b tests/usr.bin/xlint/lint1/msg_338.exp
--- a/tests/usr.bin/xlint/lint1/msg_338.exp Sun Aug 22 21:27:15 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_338.exp Sun Aug 22 22:09:57 2021 +0000
@@ -2,3 +2,4 @@
msg_338.c(28): warning: option 'f' should be listed in the options string [339]
msg_338.c(14): warning: option 'c' should be handled in the switch [338]
msg_338.c(14): warning: option 'd' should be handled in the switch [338]
+msg_338.c(65): warning: option '?' should be handled in the switch [338]
Home |
Main Index |
Thread Index |
Old Index