| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: main1.c,v 1.68 2023/07/03 09:33:07 rillig Exp $ */ | | 1 | /* $NetBSD: main1.c,v 1.69 2023/07/03 10:14:31 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1994, 1995 Jochen Pohl | | 4 | * Copyright (c) 1994, 1995 Jochen Pohl |
5 | * All Rights Reserved. | | 5 | * All Rights Reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -27,94 +27,52 @@ | | | @@ -27,94 +27,52 @@ |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #if HAVE_NBTOOL_CONFIG_H | | 34 | #if HAVE_NBTOOL_CONFIG_H |
35 | #include "nbtool_config.h" | | 35 | #include "nbtool_config.h" |
36 | #endif | | 36 | #endif |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | #if defined(__RCSID) | | 39 | #if defined(__RCSID) |
40 | __RCSID("$NetBSD: main1.c,v 1.68 2023/07/03 09:33:07 rillig Exp $"); | | 40 | __RCSID("$NetBSD: main1.c,v 1.69 2023/07/03 10:14:31 rillig Exp $"); |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <sys/types.h> | | 43 | #include <sys/types.h> |
44 | #include <signal.h> | | 44 | #include <signal.h> |
45 | #include <stdio.h> | | 45 | #include <stdio.h> |
46 | #include <stdlib.h> | | 46 | #include <stdlib.h> |
47 | #include <string.h> | | 47 | #include <string.h> |
48 | #include <unistd.h> | | 48 | #include <unistd.h> |
49 | | | 49 | |
50 | #include "lint1.h" | | 50 | #include "lint1.h" |
51 | | | 51 | |
52 | /* set yydebug to 1*/ | | | |
53 | bool yflag; | | | |
54 | | | | |
55 | /* | | | |
56 | * Print warnings if an assignment of an integer type to another integer type | | | |
57 | * causes an implicit narrowing conversion. If aflag is 1, these warnings | | | |
58 | * are printed only if the source type is at least as wide as long. If aflag | | | |
59 | * is greater than 1, they are always printed. | | | |
60 | */ | | | |
61 | int aflag; | | 52 | int aflag; |
62 | | | | |
63 | /* Print a warning if a break statement cannot be reached. */ | | | |
64 | bool bflag; | | 53 | bool bflag; |
65 | | | | |
66 | /* Print warnings for pointer casts. */ | | | |
67 | bool cflag; | | 54 | bool cflag; |
68 | | | | |
69 | /* Perform stricter checking of enum types and operations on enum types. */ | | | |
70 | bool eflag; | | 55 | bool eflag; |
71 | | | | |
72 | /* Print complete pathnames, not only the basename. */ | | | |
73 | bool Fflag; | | 56 | bool Fflag; |
74 | | | | |
75 | /* Treat warnings as errors */ | | | |
76 | bool wflag; | | | |
77 | | | | |
78 | /* | | | |
79 | * Apply a number of heuristic tests to attempt to intuit bugs, improve | | | |
80 | * style, and reduce waste. | | | |
81 | */ | | | |
82 | bool hflag; | | 57 | bool hflag; |
83 | | | 58 | bool Pflag; |
84 | /* Attempt to check portability to other dialects of C. */ | | | |
85 | bool pflag; | | 59 | bool pflag; |
86 | | | | |
87 | /* | | | |
88 | * In case of redeclarations/redefinitions print the location of the | | | |
89 | * previous declaration/definition. | | | |
90 | */ | | | |
91 | bool rflag; | | 60 | bool rflag; |
92 | | | | |
93 | bool Tflag; | | 61 | bool Tflag; |
94 | | | | |
95 | /* Picky flag */ | | | |
96 | bool Pflag; | | | |
97 | | | | |
98 | /* | | | |
99 | * Complain about functions and external variables used and not defined, | | | |
100 | * or defined and not used. | | | |
101 | */ | | | |
102 | bool uflag = true; | | 62 | bool uflag = true; |
103 | | | | |
104 | /* Complain about unused function arguments. */ | | | |
105 | bool vflag = true; | | 63 | bool vflag = true; |
106 | | | 64 | bool wflag; |
107 | /* Complain about structures which are never defined. */ | | 65 | bool yflag; |
108 | bool zflag = true; | | 66 | bool zflag = true; |
109 | | | 67 | |
110 | /* | | 68 | /* |
111 | * The default language level is the one that checks for compatibility | | 69 | * The default language level is the one that checks for compatibility |
112 | * between traditional C and C90. As of 2022, this default is no longer | | 70 | * between traditional C and C90. As of 2022, this default is no longer |
113 | * useful since most traditional C code has already been migrated. | | 71 | * useful since most traditional C code has already been migrated. |
114 | */ | | 72 | */ |
115 | bool allow_trad = true; | | 73 | bool allow_trad = true; |
116 | bool allow_c90 = true; | | 74 | bool allow_c90 = true; |
117 | bool allow_c99; | | 75 | bool allow_c99; |
118 | bool allow_c11; | | 76 | bool allow_c11; |
119 | bool allow_c23; | | 77 | bool allow_c23; |
120 | bool allow_gcc; | | 78 | bool allow_gcc; |