fixed some bugs, changed warning interface
authoreck <none@none>
Fri, 27 Oct 1989 13:33:10 +0000 (13:33 +0000)
committereck <none@none>
Fri, 27 Oct 1989 13:33:10 +0000 (13:33 +0000)
lang/cem/cemcom.ansi/domacro.c
lang/cem/cemcom.ansi/expr.c
lang/cem/cemcom.ansi/idf.c
lang/cem/cemcom.ansi/options.c
lang/cem/cemcom.ansi/proto.c

index 6b07c5e..a24259d 100644 (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");
        }
index 185e36e..dc863cb 100644 (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))
index 880bc5f..dd49b99 100644 (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) {
index 548d42d..7572077 100644 (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
index 53b096e..5864133 100644 (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;