Home | History | Annotate | Line # | Download | only in lint1
err.c revision 1.2
      1  1.2  cgd /*	$NetBSD: err.c,v 1.2 1995/07/03 21:24:04 cgd Exp $	*/
      2  1.2  cgd 
      3  1.1  cgd /*
      4  1.1  cgd  * Copyright (c) 1994, 1995 Jochen Pohl
      5  1.1  cgd  * All Rights Reserved.
      6  1.1  cgd  *
      7  1.1  cgd  * Redistribution and use in source and binary forms, with or without
      8  1.1  cgd  * modification, are permitted provided that the following conditions
      9  1.1  cgd  * are met:
     10  1.1  cgd  * 1. Redistributions of source code must retain the above copyright
     11  1.1  cgd  *    notice, this list of conditions and the following disclaimer.
     12  1.1  cgd  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  cgd  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  cgd  *    documentation and/or other materials provided with the distribution.
     15  1.1  cgd  * 3. All advertising materials mentioning features or use of this software
     16  1.1  cgd  *    must display the following acknowledgement:
     17  1.1  cgd  *      This product includes software developed by Jochen Pohl for
     18  1.1  cgd  *	The NetBSD Project.
     19  1.1  cgd  * 4. The name of the author may not be used to endorse or promote products
     20  1.1  cgd  *    derived from this software without specific prior written permission.
     21  1.1  cgd  *
     22  1.1  cgd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23  1.1  cgd  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24  1.1  cgd  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.1  cgd  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26  1.1  cgd  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27  1.1  cgd  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  1.1  cgd  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  1.1  cgd  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  1.1  cgd  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31  1.1  cgd  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  1.1  cgd  */
     33  1.1  cgd 
     34  1.1  cgd #ifndef lint
     35  1.2  cgd static char rcsid[] = "$NetBSD: err.c,v 1.2 1995/07/03 21:24:04 cgd Exp $";
     36  1.1  cgd #endif
     37  1.1  cgd 
     38  1.1  cgd /* number of errors found */
     39  1.1  cgd int	nerr;
     40  1.1  cgd 
     41  1.1  cgd /* number of syntax errors */
     42  1.1  cgd int	sytxerr;
     43  1.1  cgd 
     44  1.1  cgd #include <stdlib.h>
     45  1.1  cgd #ifdef __STDC__
     46  1.1  cgd #include <stdarg.h>
     47  1.1  cgd #else
     48  1.1  cgd #include <varargs.h>
     49  1.1  cgd #endif
     50  1.1  cgd 
     51  1.1  cgd #include "lint1.h"
     52  1.1  cgd 
     53  1.1  cgd static	const	char *basename __P((const char *));
     54  1.1  cgd 
     55  1.1  cgd const	char *msgs[] = {
     56  1.1  cgd 	"syntax error: empty declaration",			      /* 0 */
     57  1.1  cgd 	"old style declaration; add int",			      /* 1 */
     58  1.1  cgd 	"empty declaration",					      /* 2 */
     59  1.1  cgd 	"%s declared in argument declaration list",		      /* 3 */
     60  1.1  cgd 	"illegal type combination",				      /* 4 */
     61  1.1  cgd 	"modifying typedef with '%s'; only qualifiers allowed",	      /* 5 */
     62  1.1  cgd 	"use 'double' instead of 'long float'",			      /* 6 */
     63  1.1  cgd 	"only one storage class allowed",			      /* 7 */
     64  1.1  cgd 	"illegal storage class",				      /* 8 */
     65  1.1  cgd 	"only register valid as formal parameter storage class",      /* 9 */
     66  1.1  cgd 	"duplicate '%s'",					      /* 10 */
     67  1.1  cgd 	"bit-field initializer out of range",			      /* 11 */
     68  1.1  cgd 	"compiler takes size of function",			      /* 12 */
     69  1.1  cgd 	"incomplete enum type: %s",				      /* 13 */
     70  1.1  cgd 	"compiler takes alignment of function",			      /* 14 */
     71  1.1  cgd 	"function returns illegal type",			      /* 15 */
     72  1.1  cgd 	"array of function is illegal",				      /* 16 */
     73  1.1  cgd 	"null dimension",					      /* 17 */
     74  1.1  cgd 	"illegal use of 'void'",				      /* 18 */
     75  1.1  cgd 	"void type for %s",					      /* 19 */
     76  1.1  cgd 	"zero or negative array dimension",			      /* 20 */
     77  1.1  cgd 	"redeclaration of formal parameter %s",			      /* 21 */
     78  1.1  cgd 	"incomplete or misplaced function definition",		      /* 22 */
     79  1.1  cgd 	"undefined label %s",					      /* 23 */
     80  1.1  cgd 	"cannot initialize function: %s",			      /* 24 */
     81  1.1  cgd 	"cannot initialize typedef: %s",			      /* 25 */
     82  1.1  cgd 	"cannot initialize extern declaration: %s",		      /* 26 */
     83  1.1  cgd 	"redeclaration of %s",					      /* 27 */
     84  1.1  cgd 	"redefinition of %s",					      /* 28 */
     85  1.1  cgd 	"previously declared extern, becomes static: %s",	      /* 29 */
     86  1.1  cgd 	"redeclaration of %s; ANSI C requires static",		      /* 30 */
     87  1.1  cgd 	"incomplete structure or union %s: %s",			      /* 31 */
     88  1.1  cgd 	"argument type defaults to 'int': %s",			      /* 32 */
     89  1.1  cgd 	"duplicate member name: %s",				      /* 33 */
     90  1.1  cgd 	"nonportable bit-field type",				      /* 34 */
     91  1.1  cgd 	"illegal bit-field type",				      /* 35 */
     92  1.1  cgd 	"illegal bit-field size",				      /* 36 */
     93  1.1  cgd 	"zero size bit-field",					      /* 37 */
     94  1.1  cgd 	"function illegal in structure or union",		      /* 38 */
     95  1.1  cgd 	"illegal zero sized structure member: %s",		      /* 39 */
     96  1.1  cgd 	"unknown size: %s",					      /* 40 */
     97  1.1  cgd 	"illegal use of bit-field",				      /* 41 */
     98  1.1  cgd 	"forward reference to enum type",			      /* 42 */
     99  1.1  cgd 	"redefinition hides earlier one: %s",			      /* 43 */
    100  1.1  cgd 	"declaration introduces new type in ANSI C: %s %s",	      /* 44 */
    101  1.1  cgd 	"base type is really '%s %s'",				      /* 45 */
    102  1.1  cgd 	"(%s) tag redeclared",					      /* 46 */
    103  1.1  cgd 	"zero sized %s",					      /* 47 */
    104  1.1  cgd 	"overflow in enumeration values: %s",			      /* 48 */
    105  1.1  cgd 	"struct or union member must be named",			      /* 49 */
    106  1.1  cgd 	"a function is declared as an argument: %s",		      /* 50 */
    107  1.1  cgd 	"parameter mismatch: %d declared, %d defined",		      /* 51 */
    108  1.1  cgd 	"cannot initialize parameter: %s",			      /* 52 */
    109  1.1  cgd 	"declared argument %s is missing",			      /* 53 */
    110  1.1  cgd 	"trailing ',' prohibited in enum declaration",		      /* 54 */
    111  1.1  cgd 	"integral constant expression expected",		      /* 55 */
    112  1.1  cgd 	"integral constant too large",				      /* 56 */
    113  1.1  cgd 	"enumeration constant hides parameter: %s",		      /* 57 */
    114  1.1  cgd 	"type does not match prototype: %s",			      /* 58 */
    115  1.1  cgd 	"formal parameter lacks name: param #%d",		      /* 59 */
    116  1.1  cgd 	"void must be sole parameter",				      /* 60 */
    117  1.1  cgd 	"void parameter cannot have name: %s",			      /* 61 */
    118  1.1  cgd 	"function prototype parameters must have types",	      /* 62 */
    119  1.1  cgd 	"prototype does not match old-style definition",	      /* 63 */
    120  1.1  cgd 	"()-less function definition",				      /* 64 */
    121  1.1  cgd 	"%s has no named members",				      /* 65 */
    122  1.1  cgd 	"syntax requires ';' after last struct/union member",	      /* 66 */
    123  1.1  cgd 	"cannot return incomplete type",			      /* 67 */
    124  1.1  cgd 	"typedef already qualified with '%s'",			      /* 68 */
    125  1.1  cgd 	"inappropriate qualifiers with 'void'",			      /* 69 */
    126  1.1  cgd 	"%soperand of '%s' is unsigned in ANSI C",		      /* 70 */
    127  1.1  cgd 	"too many characters in character constant",		      /* 71 */
    128  1.1  cgd 	"typedef declares no type name",			      /* 72 */
    129  1.1  cgd 	"empty character constant",				      /* 73 */
    130  1.1  cgd 	"no hex digits follow \\x",				      /* 74 */
    131  1.1  cgd 	"overflow in hex escape",				      /* 75 */
    132  1.1  cgd 	"character escape does not fit in character",		      /* 76 */
    133  1.1  cgd 	"bad octal digit %c",					      /* 77 */
    134  1.1  cgd 	"nonportable character escape",				      /* 78 */
    135  1.1  cgd 	"dubious escape \\%c",					      /* 79 */
    136  1.1  cgd 	"dubious escape \\%o",					      /* 80 */
    137  1.1  cgd 	"\\a undefined in traditional C",			      /* 81 */
    138  1.1  cgd 	"\\x undefined in traditional C",			      /* 82 */
    139  1.1  cgd 	"storage class after type is obsolescent",		      /* 83 */
    140  1.1  cgd 	"ANSI C requires formal parameter before '...'",	      /* 84 */
    141  1.1  cgd 	"dubious tag declaration: %s %s",			      /* 85 */
    142  1.1  cgd 	"automatic hides external declaration: %s",		      /* 86 */
    143  1.1  cgd 	"static hides external declaration: %s",		      /* 87 */
    144  1.1  cgd 	"typedef hides external declaration: %s",		      /* 88 */
    145  1.1  cgd 	"typedef redeclared: %s",				      /* 89 */
    146  1.1  cgd 	"inconsistent redeclaration of extern: %s",		      /* 90 */
    147  1.1  cgd 	"declaration hides parameter: %s",			      /* 91 */
    148  1.1  cgd 	"inconsistent redeclaration of static: %s",		      /* 92 */
    149  1.1  cgd 	"dubious static function at block level: %s",		      /* 93 */
    150  1.1  cgd 	"function has illegal storage class: %s",		      /* 94 */
    151  1.1  cgd 	"declaration hides earlier one: %s",			      /* 95 */
    152  1.1  cgd 	"cannot dereference non-pointer type",			      /* 96 */
    153  1.1  cgd 	"suffix U is illegal in traditional C",			      /* 97 */
    154  1.1  cgd 	"suffixes F and L are illegal in traditional C",	      /* 98 */
    155  1.1  cgd 	"%s undefined",						      /* 99 */
    156  1.1  cgd 	"unary + is illegal in traditional C",			      /* 100 */
    157  1.1  cgd 	"undefined struct/union member: %s",			      /* 101 */
    158  1.1  cgd 	"illegal member use: %s",				      /* 102 */
    159  1.1  cgd 	"left operand of '.' must be struct/union object",	      /* 103 */
    160  1.1  cgd 	"left operand of '->' must be pointer to struct/union",	      /* 104 */
    161  1.1  cgd 	"non-unique member requires struct/union %s",		      /* 105 */
    162  1.1  cgd 	"left operand of '->' must be pointer",			      /* 106 */
    163  1.1  cgd 	"operands of '%s' have incompatible types",		      /* 107 */
    164  1.1  cgd 	"operand of '%s' has incompatible type",		      /* 108 */
    165  1.1  cgd 	"void type illegal in expression",			      /* 109 */
    166  1.1  cgd 	"pointer to function is not allowed here",		      /* 110 */
    167  1.1  cgd 	"unacceptable operand of '%s'",				      /* 111 */
    168  1.1  cgd 	"cannot take address of bit-field",			      /* 112 */
    169  1.1  cgd 	"cannot take address of register %s",			      /* 113 */
    170  1.1  cgd 	"%soperand of '%s' must be lvalue",			      /* 114 */
    171  1.1  cgd 	"%soperand of '%s' must be modifiable lvalue",		      /* 115 */
    172  1.1  cgd 	"illegal pointer subtraction",				      /* 116 */
    173  1.1  cgd 	"bitwise operation on signed value possibly nonportable",     /* 117 */
    174  1.1  cgd 	"semantics of '%s' change in ANSI C; use explicit cast",      /* 118 */
    175  1.1  cgd 	"conversion of '%s' to '%s' is out of range",		      /* 119 */
    176  1.1  cgd 	"bitwise operation on signed value nonportable",	      /* 120 */
    177  1.1  cgd 	"negative shift",					      /* 121 */
    178  1.1  cgd 	"shift greater than size of object",			      /* 122 */
    179  1.1  cgd 	"illegal combination of pointer and integer, op %s",	      /* 123 */
    180  1.1  cgd 	"illegal pointer combination, op %s",			      /* 124 */
    181  1.1  cgd 	"ANSI C forbids ordered comparisons of pointers to functions",/* 125 */
    182  1.1  cgd 	"incompatible types in conditional",			      /* 126 */
    183  1.1  cgd 	"'&' before array or function: ignored",		      /* 127 */
    184  1.1  cgd 	"operands have incompatible pointer types, op %s",	      /* 128 */
    185  1.1  cgd 	"expression has null effect",				      /* 129 */
    186  1.1  cgd 	"enum type mismatch, op %s",				      /* 130 */
    187  1.1  cgd 	"conversion to '%s' may sign-extend incorrectly",	      /* 131 */
    188  1.1  cgd 	"conversion from '%s' may lose accuracy",		      /* 132 */
    189  1.1  cgd 	"conversion of pointer to '%s' loses bits",		      /* 133 */
    190  1.1  cgd 	"conversion of pointer to '%s' may lose bits",		      /* 134 */
    191  1.1  cgd 	"possible pointer alignment problem",			      /* 135 */
    192  1.1  cgd 	"cannot do pointer arithmetic on operand of unknown size",    /* 136 */
    193  1.1  cgd 	"use of incomplete enum type, op %s",			      /* 137 */
    194  1.1  cgd 	"unknown operand size, op %s",				      /* 138 */
    195  1.1  cgd 	"division by 0",					      /* 139 */
    196  1.1  cgd 	"modulus by 0",						      /* 140 */
    197  1.1  cgd 	"integer overflow detected, op %s",			      /* 141 */
    198  1.1  cgd 	"floating point overflow detected, op %s",		      /* 142 */
    199  1.1  cgd 	"cannot take size of incomplete type",			      /* 143 */
    200  1.1  cgd 	"cannot take size of function",				      /* 144 */
    201  1.1  cgd 	"cannot take size of bit-field",			      /* 145 */
    202  1.1  cgd 	"cannot take size of void",				      /* 146 */
    203  1.1  cgd 	"invalid cast expression",				      /* 147 */
    204  1.1  cgd 	"improper cast of void expression",			      /* 148 */
    205  1.1  cgd 	"illegal function",					      /* 149 */
    206  1.1  cgd 	"argument mismatch: %d arg%s passed, %d expected",	      /* 150 */
    207  1.1  cgd 	"void expressions may not be arguments, arg #%d",	      /* 151 */
    208  1.1  cgd 	"argument cannot have unknown size, arg #%d",		      /* 152 */
    209  1.1  cgd 	"argument has incompatible pointer type, arg #%d",	      /* 153 */
    210  1.1  cgd 	"illegal combination of pointer and integer, arg #%d",	      /* 154 */
    211  1.1  cgd 	"argument is incompatible with prototype, arg #%d",	      /* 155 */
    212  1.1  cgd 	"enum type mismatch, arg #%d",			       	      /* 156 */
    213  1.1  cgd 	"ANSI C treats constant as unsigned",			      /* 157 */
    214  1.1  cgd 	"%s may be used before set",			      	      /* 158 */
    215  1.1  cgd 	"assignment in conditional context",			      /* 159 */
    216  1.1  cgd 	"operator '==' found where '=' was expected",		      /* 160 */
    217  1.1  cgd 	"constant in conditional context",			      /* 161 */
    218  1.1  cgd 	"comparision of %s with %s, op %s",			      /* 162 */
    219  1.1  cgd 	"a cast does not yield an lvalue",			      /* 163 */
    220  1.1  cgd 	"assignment of negative constant to unsigned type",	      /* 164 */
    221  1.1  cgd 	"constant truncated by assignment",			      /* 165 */
    222  1.1  cgd 	"precision lost in bit-field assignment",		      /* 166 */
    223  1.1  cgd 	"array subscript cannot be negative: %ld",		      /* 167 */
    224  1.1  cgd 	"array subscript cannot be > %d: %ld",			      /* 168 */
    225  1.1  cgd 	"precedence confusion possible: parenthesize!",		      /* 169 */
    226  1.1  cgd 	"first operand must have scalar type, op ? :",		      /* 170 */
    227  1.1  cgd 	"assignment type mismatch",				      /* 171 */
    228  1.1  cgd 	"too many struct/union initializers",			      /* 172 */
    229  1.1  cgd 	"too many array initializers",				      /* 173 */
    230  1.1  cgd 	"too many initializers",				      /* 174 */
    231  1.1  cgd 	"initialisation of an incomplete type",			      /* 175 */
    232  1.1  cgd 	"invalid initializer",					      /* 176 */
    233  1.1  cgd 	"non-constant initializer",				      /* 177 */
    234  1.1  cgd 	"initializer does not fit",				      /* 178 */
    235  1.1  cgd 	"cannot initialize struct/union with no named member",	      /* 179 */
    236  1.1  cgd 	"bit-field initializer does not fit",			      /* 180 */
    237  1.1  cgd 	"{}-enclosed initializer required",			      /* 181 */
    238  1.1  cgd 	"incompatible pointer types",				      /* 182 */
    239  1.1  cgd 	"illegal combination of pointer and integer",		      /* 183 */
    240  1.1  cgd 	"illegal pointer combination",				      /* 184 */
    241  1.1  cgd 	"initialisation type mismatch",				      /* 185 */
    242  1.1  cgd 	"bit-field initialisation is illegal in traditional C",	      /* 186 */
    243  1.1  cgd 	"non-null byte ignored in string initializer",		      /* 187 */
    244  1.1  cgd 	"no automatic aggregate initialization in traditional C",     /* 188 */
    245  1.1  cgd 	"assignment of struct/union illegal in traditional C",	      /* 189 */
    246  1.1  cgd 	"empty array declaration: %s",				      /* 190 */
    247  1.1  cgd 	"%s set but not used in function %s",		      	      /* 191 */
    248  1.1  cgd 	"%s unused in function %s",				      /* 192 */
    249  1.1  cgd 	"statement not reached",				      /* 193 */
    250  1.1  cgd 	"label %s redefined",					      /* 194 */
    251  1.1  cgd 	"case not in switch",					      /* 195 */
    252  1.1  cgd 	"case label affected by conversion",			      /* 196 */
    253  1.1  cgd 	"non-constant case expression",				      /* 197 */
    254  1.1  cgd 	"non-integral case expression",				      /* 198 */
    255  1.1  cgd 	"duplicate case in switch: %ld",			      /* 199 */
    256  1.1  cgd 	"duplicate case in switch: %lu",			      /* 200 */
    257  1.1  cgd 	"default outside switch",				      /* 201 */
    258  1.1  cgd 	"duplicate default in switch",				      /* 202 */
    259  1.1  cgd 	"case label must be of type `int' in traditional C",	      /* 203 */
    260  1.1  cgd 	"controlling expressions must have scalar type",	      /* 204 */
    261  1.1  cgd 	"switch expression must have integral type",		      /* 205 */
    262  1.1  cgd 	"enumeration value(s) not handled in switch",		      /* 206 */
    263  1.1  cgd 	"loop not entered at top",				      /* 207 */
    264  1.1  cgd 	"break outside loop or switch",				      /* 208 */
    265  1.1  cgd 	"continue outside loop",				      /* 209 */
    266  1.1  cgd 	"enum type mismatch in initialisation",			      /* 210 */
    267  1.1  cgd 	"return value type mismatch",				      /* 211 */
    268  1.1  cgd 	"cannot return incomplete type",			      /* 212 */
    269  1.1  cgd 	"void function %s cannot return value",			      /* 213 */
    270  1.1  cgd 	"function %s expects to return value",			      /* 214 */
    271  1.1  cgd 	"function implicitly declared to return int",		      /* 215 */
    272  1.1  cgd 	"function %s has return (e); and return;",		      /* 216 */
    273  1.1  cgd 	"function %s falls off bottom without returning value",	      /* 217 */
    274  1.1  cgd 	"ANSI C treats constant as unsigned, op %s",		      /* 218 */
    275  1.1  cgd 	"concatenated strings are illegal in traditional C",	      /* 219 */
    276  1.1  cgd 	"fallthrough on case statement",			      /* 220 */
    277  1.1  cgd 	"initialisation of unsigned with negative constant",	      /* 221 */
    278  1.1  cgd 	"conversion of negative constant to unsigned type",	      /* 222 */
    279  1.1  cgd 	"end-of-loop code not reached",				      /* 223 */
    280  1.1  cgd 	"cannot recover from previous errors",			      /* 224 */
    281  1.1  cgd 	"static function called but not defined: %s()",		      /* 225 */
    282  1.1  cgd 	"static variable %s unused",				      /* 226 */
    283  1.1  cgd 	"const object %s should have initializer",		      /* 227 */
    284  1.1  cgd 	"function cannot return const or volatile object",	      /* 228 */
    285  1.1  cgd 	"questionable conversion of function pointer",		      /* 229 */
    286  1.1  cgd 	"nonportable character comparision, op %s",		      /* 230 */
    287  1.1  cgd 	"argument %s unused in function %s",			      /* 231 */
    288  1.1  cgd 	"label %s unused in function %s",			      /* 232 */
    289  1.1  cgd 	"struct %s never defined",				      /* 233 */
    290  1.1  cgd 	"union %s never defined",				      /* 234 */
    291  1.1  cgd 	"enum %s never defined",				      /* 235 */
    292  1.1  cgd 	"static function %s unused",				      /* 236 */
    293  1.1  cgd 	"redeclaration of formal parameter %s",			      /* 237 */
    294  1.1  cgd 	"initialisation of union is illegal in traditional C",	      /* 238 */
    295  1.1  cgd 	"constant argument to NOT",				      /* 239 */
    296  1.1  cgd 	"assignment of different structures",			      /* 240 */
    297  1.1  cgd 	"dubious operation on enum, op %s",			      /* 241 */
    298  1.1  cgd 	"combination of '%s' and '%s', op %s",			      /* 242 */
    299  1.1  cgd 	"dubious comparision of enums, op %s",			      /* 243 */
    300  1.1  cgd 	"illegal structure pointer combination",		      /* 244 */
    301  1.1  cgd 	"illegal structure pointer combination, op %s",		      /* 245 */
    302  1.1  cgd 	"dubious conversion of enum to '%s'",			      /* 246 */
    303  1.1  cgd 	"pointer casts may be troublesome",			      /* 247 */
    304  1.1  cgd 	"floating-point constant out of range",			      /* 248 */
    305  1.1  cgd 	"syntax error",						      /* 249 */
    306  1.1  cgd 	"unknown character \\%o",				      /* 250 */
    307  1.1  cgd 	"malformed integer constant",				      /* 251 */
    308  1.1  cgd 	"integer constant out of range",			      /* 252 */
    309  1.1  cgd 	"unterminated character constant",			      /* 253 */
    310  1.1  cgd 	"newline in string or char constant",			      /* 254 */
    311  1.1  cgd 	"undefined or invalid # directive",			      /* 255 */
    312  1.1  cgd 	"unterminated comment",					      /* 256 */
    313  1.1  cgd 	"extra characters in lint comment",			      /* 257 */
    314  1.1  cgd 	"unterminated string constant",				      /* 258 */
    315  1.1  cgd 	"conversion to '%s' due to prototype, arg #%d",		      /* 259 */
    316  1.1  cgd 	"previous declaration of %s",				      /* 260 */
    317  1.1  cgd 	"previous definition of %s",				      /* 261 */
    318  1.1  cgd 	"\\\" inside character constants undefined in traditional C", /* 262 */
    319  1.1  cgd 	"\\? undefined in traditional C",			      /* 263 */
    320  1.1  cgd 	"\\v undefined in traditional C",			      /* 264 */
    321  1.1  cgd 	"'signed' illegal in traditional C",			      /* 265 */
    322  1.1  cgd 	"'long double' is illegal in traditional C",		      /* 266 */
    323  1.1  cgd 	"shift equal to size of object",			      /* 267 */
    324  1.1  cgd 	"",							      /* 268*/
    325  1.1  cgd 	"const and volatile are illegal in traditional C",	      /* 269 */
    326  1.1  cgd 	"function prototypes are illegal in traditional C",	      /* 270 */
    327  1.1  cgd 	"switch expression must be of type `int' in traditional C",   /* 271 */
    328  1.1  cgd 	"empty translation unit",				      /* 272 */
    329  1.1  cgd 	"bit-field type '%s' invalid in ANSI C",		      /* 273 */
    330  1.1  cgd 	"ANSI C forbids comparision of %s with %s",		      /* 274 */
    331  1.1  cgd 	"",							      /* 275 */
    332  1.1  cgd 	"",							      /* 276 */
    333  1.1  cgd 	"initialisation of '%s' with '%s'",			      /* 277 */
    334  1.1  cgd 	"combination of '%s' and '%s', arg #%d",		      /* 278 */
    335  1.1  cgd 	"combination of '%s' and '%s' in return",		      /* 279 */
    336  1.1  cgd 	"must be outside function: /* %s */",			      /* 280 */
    337  1.1  cgd 	"duplicate use of /* %s */",				      /* 281 */
    338  1.1  cgd 	"must precede function definition: /* %s */",		      /* 282 */
    339  1.1  cgd 	"argument number mismatch with directive: /* %s */",	      /* 283 */
    340  1.1  cgd 	"fallthrough on default statement",			      /* 284 */
    341  1.1  cgd 	"prototype declaration",				      /* 285 */
    342  1.1  cgd 	"function definition is not a prototype",		      /* 286 */
    343  1.1  cgd 	"function declaration is not a prototype",		      /* 287 */
    344  1.1  cgd 	"dubious use of /* VARARGS */ with /* %s */",		      /* 288 */
    345  1.1  cgd 	"can't be used together: /* PRINTFLIKE */ /* SCANFLIKE */",   /* 289 */
    346  1.1  cgd 	"static function %s declared but not defined",		      /* 290 */
    347  1.1  cgd 	"invalid multibyte character",				      /* 291 */
    348  1.1  cgd 	"cannot concatenate wide and regular string literals",	      /* 292 */
    349  1.1  cgd 	"argument %d must be 'char *' for PRINTFLIKE/SCANFLIKE",      /* 293 */
    350  1.1  cgd 	"multi-character character constant",			      /* 294 */
    351  1.1  cgd 	"conversion of '%s' to '%s' is out of range, arg #%d",	      /* 295 */
    352  1.1  cgd 	"conversion of negative constant to unsigned type, arg #%d",  /* 296 */
    353  1.1  cgd 	"conversion to '%s' may sign-extend incorrectly, arg #%d",    /* 297 */
    354  1.1  cgd 	"conversion from '%s' may lose accuracy, arg #%d",	      /* 298 */
    355  1.1  cgd 	"prototype does not match old style definition, arg #%d",     /* 299 */
    356  1.1  cgd 	"old style definition",					      /* 300 */
    357  1.1  cgd 	"array of incomplete type",				      /* 301 */
    358  1.1  cgd 	"%s returns pointer to automatic object",		      /* 302 */
    359  1.1  cgd 	"ANSI C forbids conversion of %s to %s",		      /* 303 */
    360  1.1  cgd 	"ANSI C forbids conversion of %s to %s, arg #%d",	      /* 304 */
    361  1.1  cgd 	"ANSI C forbids conversion of %s to %s, op %s",		      /* 305 */
    362  1.1  cgd 	"constant truncated by conversion, op %s",		      /* 306 */
    363  1.1  cgd 	"static variable %s set but not used",			      /* 307 */
    364  1.1  cgd 	"extra bits set to 1 in conversion of '%s' to '%s', op %s",   /* 308 */
    365  1.1  cgd 	"extra bits set to 0 in conversion of '%s' to '%s', op %s",   /* 309 */
    366  1.1  cgd };
    367  1.1  cgd 
    368  1.1  cgd /*
    369  1.1  cgd  * If Fflag is not set basename() returns a pointer to the last
    370  1.1  cgd  * component of the path, otherwise it returns the argument.
    371  1.1  cgd  */
    372  1.1  cgd static const char *
    373  1.1  cgd basename(path)
    374  1.1  cgd 	const	char *path;
    375  1.1  cgd {
    376  1.1  cgd 	const	char *cp, *cp1, *cp2;
    377  1.1  cgd 
    378  1.1  cgd 	if (Fflag)
    379  1.1  cgd 		return (path);
    380  1.1  cgd 
    381  1.1  cgd 	cp = cp1 = cp2 = path;
    382  1.1  cgd 	while (*cp != '\0') {
    383  1.1  cgd 		if (*cp++ == '/') {
    384  1.1  cgd 			cp2 = cp1;
    385  1.1  cgd 			cp1 = cp;
    386  1.1  cgd 		}
    387  1.1  cgd 	}
    388  1.1  cgd 	return (*cp1 == '\0' ? cp2 : cp1);
    389  1.1  cgd }
    390  1.1  cgd 
    391  1.1  cgd #ifdef __STDC__
    392  1.1  cgd void
    393  1.1  cgd error(int n, ...)
    394  1.1  cgd {
    395  1.1  cgd #else
    396  1.1  cgd void
    397  1.1  cgd error(va_alist)
    398  1.1  cgd 	va_dcl
    399  1.1  cgd {
    400  1.1  cgd 	int	n;
    401  1.1  cgd #endif
    402  1.1  cgd 	va_list	ap;
    403  1.1  cgd 	const	char *fn;
    404  1.1  cgd 
    405  1.1  cgd #ifdef __STDC__
    406  1.1  cgd 	va_start(ap, n);
    407  1.1  cgd #else
    408  1.1  cgd 	va_start(ap);
    409  1.1  cgd 	n = va_arg(ap, int);
    410  1.1  cgd #endif
    411  1.1  cgd 	fn = basename(curr_pos.p_file);
    412  1.1  cgd 	(void)printf("%s(%d): ", fn, curr_pos.p_line);
    413  1.1  cgd 	(void)vprintf(msgs[n], ap);
    414  1.1  cgd 	(void)printf("\n");
    415  1.1  cgd 	nerr++;
    416  1.1  cgd 	va_end(ap);
    417  1.1  cgd }
    418  1.1  cgd 
    419  1.1  cgd #ifdef __STDC__
    420  1.1  cgd void
    421  1.1  cgd lerror(const char *msg, ...)
    422  1.1  cgd {
    423  1.1  cgd #else
    424  1.1  cgd void
    425  1.1  cgd lerror(va_alist)
    426  1.1  cgd 	va_dcl
    427  1.1  cgd {
    428  1.1  cgd 	const	char *msg;
    429  1.1  cgd #endif
    430  1.1  cgd 	va_list	ap;
    431  1.1  cgd 	const	char *fn;
    432  1.1  cgd 
    433  1.1  cgd #ifdef __STDC__
    434  1.1  cgd 	va_start(ap, msg);
    435  1.1  cgd #else
    436  1.1  cgd 	va_start(ap);
    437  1.1  cgd 	msg = va_arg(ap, const char *);
    438  1.1  cgd #endif
    439  1.1  cgd 	fn = basename(curr_pos.p_file);
    440  1.1  cgd 	(void)fprintf(stderr, "%s(%d): lint error: ", fn, curr_pos.p_line);
    441  1.1  cgd 	(void)vfprintf(stderr, msg, ap);
    442  1.1  cgd 	(void)fprintf(stderr, "\n");
    443  1.1  cgd 	va_end(ap);
    444  1.1  cgd 	exit(1);
    445  1.1  cgd }
    446  1.1  cgd 
    447  1.1  cgd #ifdef __STDC__
    448  1.1  cgd void
    449  1.1  cgd warning(int n, ...)
    450  1.1  cgd {
    451  1.1  cgd #else
    452  1.1  cgd void
    453  1.1  cgd warning(va_alist)
    454  1.1  cgd 	va_dcl
    455  1.1  cgd 	int	n;
    456  1.1  cgd {
    457  1.1  cgd #endif
    458  1.1  cgd 	va_list	ap;
    459  1.1  cgd 	const	char *fn;
    460  1.1  cgd 
    461  1.1  cgd #ifdef __STDC__
    462  1.1  cgd 	va_start(ap, n);
    463  1.1  cgd #else
    464  1.1  cgd 	va_start(ap);
    465  1.1  cgd 	n = va_arg(ap, int);
    466  1.1  cgd #endif
    467  1.1  cgd 	if (lline == isrcline || lline + 1 == isrcline)
    468  1.1  cgd 		/* this warning is suppressed by a LINTED comment */
    469  1.1  cgd 		return;
    470  1.1  cgd 
    471  1.1  cgd 	fn = basename(curr_pos.p_file);
    472  1.1  cgd 	(void)printf("%s(%d): warning: ", fn, curr_pos.p_line);
    473  1.1  cgd 	(void)vprintf(msgs[n], ap);
    474  1.1  cgd 	(void)printf("\n");
    475  1.1  cgd 	va_end(ap);
    476  1.1  cgd }
    477  1.1  cgd 
    478  1.1  cgd #ifdef __STDC__
    479  1.1  cgd void
    480  1.1  cgd message(int n, ...)
    481  1.1  cgd {
    482  1.1  cgd #else
    483  1.1  cgd void
    484  1.1  cgd message(va_alist)
    485  1.1  cgd 	va_dcl
    486  1.1  cgd {
    487  1.1  cgd 	int	n;
    488  1.1  cgd #endif
    489  1.1  cgd 	va_list	ap;
    490  1.1  cgd 	const	char *fn;
    491  1.1  cgd 
    492  1.1  cgd #ifdef __STDC__
    493  1.1  cgd 	va_start(ap, n);
    494  1.1  cgd #else
    495  1.1  cgd 	va_start(ap);
    496  1.1  cgd 	n = va_arg(ap, int);
    497  1.1  cgd #endif
    498  1.1  cgd 	fn = basename(curr_pos.p_file);
    499  1.1  cgd 	(void)printf("%s(%d): ", fn, curr_pos.p_line);
    500  1.1  cgd 	(void)vprintf(msgs[n], ap);
    501  1.1  cgd 	(void)printf("\n");
    502  1.1  cgd 	va_end(ap);
    503  1.1  cgd }
    504