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 $
47 * Print warnings if an assignment of an integertype to another integertype
48 * causes an implizit narrowing conversion. If aflag is 1, these warnings
49 * are printed only if the source type is at least as wide as long. If aflag
50 * is greather then 1, they are always printed.
54 /* Print a warning if a break statement cannot be reached. */
57 /* Print warnings for pointer casts. */
60 /* Print various debug information. */
63 /* Perform stricter checking of enum types and operations on enum types. */
66 /* Print complete pathnames, not only the basename. */
69 /* Enable some extensions of gcc */
73 * Apply a number of heuristic tests to attempt to intuit bugs, improve
74 * style, and reduce waste.
78 /* Attempt to check portability to other dialects of C. */
82 * In case of redeclarations/redefinitions print the location of the
83 * previous declaration/definition.
87 /* Strict ANSI C mode. */
90 /* Traditional C mode. */
94 * Complain about functions and external variables used and not defined,
95 * or defined and not used.
99 /* Complain about unused function arguments. */
102 /* Complain about structures which are never defined. */
105 static void usage __P((void));
114 while ((c = getopt(argc, argv, "abcdeghprstuvyzF")) != -1) {
116 case 'a': aflag++; break;
117 case 'b': bflag = 1; break;
118 case 'c': cflag = 1; break;
119 case 'd': dflag = 1; break;
120 case 'e': eflag = 1; break;
121 case 'F': Fflag = 1; break;
122 case 'g': gflag = 1; break;
123 case 'h': hflag = 1; break;
124 case 'p': pflag = 1; break;
125 case 'r': rflag = 1; break;
126 case 's': sflag = 1; break;
127 case 't': tflag = 1; break;
128 case 'u': uflag = 0; break;
129 case 'v': vflag = 0; break;
130 case 'y': yflag = 1; break;
131 case 'z': zflag = 0; break;
141 /* open the input file */
142 if ((yyin = fopen(argv[0], "r")) == NULL)
143 err(1, "cannot open '%s'", argv[0]);
145 /* initialize output */
158 /* Following warnings cannot be suppressed by LINTED */
171 (void)fprintf(stderr, "usage: lint1 [-abcdeghprstuvyzF] src dest\n");
178 /* cannot recover from previous errors */