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