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