#include "class.h"
#include "macro.h"
+extern char options[];
extern char **inctable; /* list of include directories */
extern char *getwdir();
char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
++(ifstack[nestlevel]);
if (!to_endif && nestlevel == skiplevel) {
if (SkipToNewLine())
- strict("garbage following #else");
+ if (!options['o'])
+ strict("garbage following #else");
NoUnstack--;
return;
}
ASSERT(nestlevel > nestlow);
if (nestlevel == skiplevel) {
if (SkipToNewLine())
- strict("garbage following #endif");
+ if (!options['o'])
+ strict("garbage following #endif");
nestlevel--;
NoUnstack--;
return;
do_else()
{
if (SkipToNewLine())
- strict("garbage following #else");
+ if (!options['o'])
+ strict("garbage following #else");
if (nestlevel <= nestlow)
lexerror("#else without corresponding #if");
else { /* mark this level as else-d */
do_endif()
{
if (SkipToNewLine())
- strict("garbage following #endif");
+ if (!options['o'])
+ strict("garbage following #endif");
if (nestlevel <= nestlow) {
lexerror("#endif without corresponding #if");
}
if (def == 0) {
if (AHEAD == '(') {
/* function call, declare name IMPLICITly (3.3.2.2) */
- warning("implicit declaration of function %s"
- , idf->id_text);
+ if (!options['o'])
+ warning("implicit declaration of function %s"
+ , idf->id_text);
add_def(idf, IMPLICIT, funint_type, level);
} else {
if (!is_anon_idf(idf))
while (du && du->du_fund != FUNCTION)
du = du->next;
- ASSERT(du);
+ if (!du) return; /* terrible error, signalled earlier */
+
if (du->du_proto) return;
- warning("'%s' old-fashioned function definition", dc->dc_idf->id_text);
+ if (!options['o'])
+ warning("'%s' old-fashioned function definition"
+ , dc->dc_idf->id_text);
if (pl) {
if (pl->pl_flag & PL_ELLIPSIS) {
case 'n': /* use no registers */
case 'w': /* no warnings will be given */
case 's': /* no stricts will be given */
+ case 'o': /* no complaints about old-style */
options[opt] = 1;
goto next_option;
+ case 'a': /* suppress all but errors diagnostics */
+ options['w'] = 1; /* implies -a */
+ options['s'] = 1;
+ goto next_option;
#endif LINT
#ifdef LINT
while((*tgpp) && (*tgpp)->tg_type != tp) {
tgpp = &((*tgpp)->next);
}
- ASSERT(*tgpp);
+ if (!*tgpp) return;
tgp = *tgpp;
if (tgp->tg_level > L_PROTO) return;