fixed some bugs, changed warning interface

This commit is contained in:
eck 1989-10-27 13:33:10 +00:00
parent f04baf2201
commit 480de7cafb
5 changed files with 23 additions and 9 deletions

View file

@ -25,6 +25,7 @@
#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 */
@ -211,7 +212,8 @@ int to_endif;
++(ifstack[nestlevel]);
if (!to_endif && nestlevel == skiplevel) {
if (SkipToNewLine())
strict("garbage following #else");
if (!options['o'])
strict("garbage following #else");
NoUnstack--;
return;
}
@ -221,7 +223,8 @@ int to_endif;
ASSERT(nestlevel > nestlow);
if (nestlevel == skiplevel) {
if (SkipToNewLine())
strict("garbage following #endif");
if (!options['o'])
strict("garbage following #endif");
nestlevel--;
NoUnstack--;
return;
@ -364,7 +367,8 @@ do_elif()
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 */
@ -379,7 +383,8 @@ do_else()
do_endif()
{
if (SkipToNewLine())
strict("garbage following #endif");
if (!options['o'])
strict("garbage following #endif");
if (nestlevel <= nestlow) {
lexerror("#endif without corresponding #if");
}

View file

@ -138,8 +138,9 @@ idf2expr(expr)
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))

View file

@ -591,10 +591,13 @@ check_formals(idf, dc)
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) {

View file

@ -68,8 +68,13 @@ next_option: /* to allow combined one-char options */
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

View file

@ -335,7 +335,7 @@ struct type *tp;
while((*tgpp) && (*tgpp)->tg_type != tp) {
tgpp = &((*tgpp)->next);
}
ASSERT(*tgpp);
if (!*tgpp) return;
tgp = *tgpp;
if (tgp->tg_level > L_PROTO) return;