From: eck Date: Fri, 27 Oct 1989 13:33:10 +0000 (+0000) Subject: fixed some bugs, changed warning interface X-Git-Tag: release-5-5~2134 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=480de7cafb553084f68118ae805a268f18786293;p=ack.git fixed some bugs, changed warning interface --- diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 6b07c5ee0..a24259d39 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -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"); } diff --git a/lang/cem/cemcom.ansi/expr.c b/lang/cem/cemcom.ansi/expr.c index 185e36e97..dc863cbb3 100644 --- a/lang/cem/cemcom.ansi/expr.c +++ b/lang/cem/cemcom.ansi/expr.c @@ -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)) diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom.ansi/idf.c index 880bc5f27..dd49b9924 100644 --- a/lang/cem/cemcom.ansi/idf.c +++ b/lang/cem/cemcom.ansi/idf.c @@ -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) { diff --git a/lang/cem/cemcom.ansi/options.c b/lang/cem/cemcom.ansi/options.c index 548d42d4a..7572077f9 100644 --- a/lang/cem/cemcom.ansi/options.c +++ b/lang/cem/cemcom.ansi/options.c @@ -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 diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom.ansi/proto.c index 53b096e84..5864133fc 100644 --- a/lang/cem/cemcom.ansi/proto.c +++ b/lang/cem/cemcom.ansi/proto.c @@ -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;