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: only define GCC builtins if -g is ...
details: https://anonhg.NetBSD.org/src/rev/9f7317d4df85
branches: trunk
changeset: 960768:9f7317d4df85
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 28 15:36:37 2021 +0000
description:
lint: only define GCC builtins if -g is given
This removes 7 wrong warnings when running lint in -t mode.
Surprisingly, this added a warning that had not been there before in
msg_189.c. This is because check_variable_usage skips the checks when
an error occurred before. All diagnostics that happened were warnings,
but the -w option treats them as errors, see vwarning.
diffstat:
tests/usr.bin/xlint/lint1/msg_050.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_054.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_081.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_082.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_100.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_186.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_188.exp | 7 -------
tests/usr.bin/xlint/lint1/msg_189.c | 3 ++-
tests/usr.bin/xlint/lint1/msg_189.exp | 8 +-------
tests/usr.bin/xlint/lint1/msg_219.exp | 7 -------
usr.bin/xlint/lint1/main1.c | 16 +++++++++-------
11 files changed, 12 insertions(+), 71 deletions(-)
diffs (171 lines):
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_050.exp
--- a/tests/usr.bin/xlint/lint1/msg_050.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_050.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,9 +1,2 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_050.c(11): warning: a function is declared as an argument: f [50]
msg_050.c(10): warning: argument f unused in function example [231]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_054.exp
--- a/tests/usr.bin/xlint/lint1/msg_054.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_054.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,8 +1,1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_054.c(12): warning: trailing ',' prohibited in enum declaration [54]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_081.exp
--- a/tests/usr.bin/xlint/lint1/msg_081.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_081.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,8 +1,1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_081.c(8): warning: \a undefined in traditional C [81]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_082.exp
--- a/tests/usr.bin/xlint/lint1/msg_082.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_082.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,8 +1,1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_082.c(8): warning: \x undefined in traditional C [82]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_100.exp
--- a/tests/usr.bin/xlint/lint1/msg_100.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_100.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,9 +1,2 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_100.c(10): warning: function prototypes are illegal in traditional C [270]
msg_100.c(11): warning: unary + is illegal in traditional C [100]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_186.exp
--- a/tests/usr.bin/xlint/lint1/msg_186.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_186.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,8 +1,1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_186.c(16): warning: bit-field initialization is illegal in traditional C [186]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_188.exp
--- a/tests/usr.bin/xlint/lint1/msg_188.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_188.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,8 +1,1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_188.c(21): warning: no automatic aggregate initialization in traditional C [188]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_189.c
--- a/tests/usr.bin/xlint/lint1/msg_189.c Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_189.c Sun Mar 28 15:36:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_189.c,v 1.2 2021/01/30 17:56:29 rillig Exp $ */
+/* $NetBSD: msg_189.c,v 1.3 2021/03/28 15:36:37 rillig Exp $ */
# 3 "msg_189.c"
/* Test for message: assignment of struct/union illegal in traditional C [189] */
@@ -16,4 +16,5 @@
a.member = 3;
b = a; /* message 189 is not triggered anymore */
+ /* expect-1: b set but not used in function example */
}
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_189.exp
--- a/tests/usr.bin/xlint/lint1/msg_189.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_189.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,7 +1,1 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
+msg_189.c(18): warning: b set but not used in function example [191]
diff -r 4f3df47e3ecc -r 9f7317d4df85 tests/usr.bin/xlint/lint1/msg_219.exp
--- a/tests/usr.bin/xlint/lint1/msg_219.exp Sun Mar 28 15:12:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_219.exp Sun Mar 28 15:36:37 2021 +0000
@@ -1,10 +1,3 @@
-(1): warning: 'long double' is illegal in traditional C [266]
-(1): warning: function prototypes are illegal in traditional C [270]
-(2): warning: 'long double' is illegal in traditional C [266]
-(2): warning: function prototypes are illegal in traditional C [270]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: 'long double' is illegal in traditional C [266]
-(3): warning: function prototypes are illegal in traditional C [270]
msg_219.c(10): warning: concatenated strings are illegal in traditional C [219]
msg_219.c(11): warning: concatenated strings are illegal in traditional C [219]
msg_219.c(12): warning: concatenated strings are illegal in traditional C [219]
diff -r 4f3df47e3ecc -r 9f7317d4df85 usr.bin/xlint/lint1/main1.c
--- a/usr.bin/xlint/lint1/main1.c Sun Mar 28 15:12:20 2021 +0000
+++ b/usr.bin/xlint/lint1/main1.c Sun Mar 28 15:36:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main1.c,v 1.40 2021/03/27 11:50:34 rillig Exp $ */
+/* $NetBSD: main1.c,v 1.41 2021/03/28 15:36:37 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main1.c,v 1.40 2021/03/27 11:50:34 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.41 2021/03/28 15:36:37 rillig Exp $");
#endif
#include <sys/types.h>
@@ -138,7 +138,7 @@
static const size_t builtinlen = sizeof builtins - 1;
static FILE *
-bltin(void)
+gcc_builtins(void)
{
#if HAVE_NBTOOL_CONFIG_H
char template[] = "/tmp/lint.XXXXXX";
@@ -254,10 +254,12 @@
initdecl();
initscan();
- if ((yyin = bltin()) == NULL)
- err(1, "cannot open builtins");
- yyparse();
- fclose(yyin);
+ if (gflag) {
+ if ((yyin = gcc_builtins()) == NULL)
+ err(1, "cannot open builtins");
+ yyparse();
+ fclose(yyin);
+ }
/* open the input file */
if ((yyin = fopen(argv[0], "r")) == NULL)
Home |
Main Index |
Thread Index |
Old Index