1 /* $NetBSD: main1.c,v 1.3 1995/10/02 17:29:56 jpo Exp $ */
4 * Copyright (c) 1994, 1995 Jochen Pohl
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Jochen Pohl for
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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
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
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * $NetBSD: main1.c,v 1.3 1995/10/02 17:29:56 jpo Exp $
34 * $DragonFly: src/usr.bin/xlint/lint1/main1.c,v 1.6 2004/07/07 12:24:00 asmodai Exp $
48 * Print warnings if an assignment of an integertype to another integertype
49 * causes an implizit narrowing conversion. If aflag is 1, these warnings
50 * are printed only if the source type is at least as wide as long. If aflag
51 * is greather then 1, they are always printed.
55 /* Print a warning if a break statement cannot be reached. */
58 /* Print warnings for pointer casts. */
61 /* Print various debug information. */
64 /* Perform stricter checking of enum types and operations on enum types. */
67 /* Print complete pathnames, not only the basename. */
70 /* Enable some extensions of gcc */
74 * Apply a number of heuristic tests to attempt to intuit bugs, improve
75 * style, and reduce waste.
79 /* Attempt to check portability to other dialects of C. */
83 * In case of redeclarations/redefinitions print the location of the
84 * previous declaration/definition.
88 /* Strict ANSI C mode. */
91 /* Traditional C mode. */
95 * Complain about functions and external variables used and not defined,
96 * or defined and not used.
100 /* Complain about unused function arguments. */
103 /* Complain about structures which are never defined. */
106 static void usage(void);
109 main(int argc
, char *argv
[])
113 while ((c
= getopt(argc
, argv
, "abcdeghprstuvyzF")) != -1) {
115 case 'a': aflag
++; break;
116 case 'b': bflag
= 1; break;
117 case 'c': cflag
= 1; break;
118 case 'd': dflag
= 1; break;
119 case 'e': eflag
= 1; break;
120 case 'F': Fflag
= 1; break;
121 case 'g': gflag
= 1; break;
122 case 'h': hflag
= 1; break;
123 case 'p': pflag
= 1; break;
124 case 'r': rflag
= 1; break;
125 case 's': sflag
= 1; break;
126 case 't': tflag
= 1; break;
127 case 'u': uflag
= 0; break;
128 case 'v': vflag
= 0; break;
129 case 'y': yflag
= 1; break;
130 case 'z': zflag
= 0; break;
140 /* open the input file */
141 if ((yyin
= fopen(argv
[0], "r")) == NULL
)
142 err(1, "cannot open '%s'", argv
[0]);
144 /* initialize output */
157 /* Following warnings cannot be suppressed by LINTED */
170 (void)fprintf(stderr
, "usage: lint1 [-abcdeghprstuvyzF] src dest\n");
177 /* cannot recover from previous errors */