Fixed bug in '#ifdef FALSE || 1 (garbage)
authorceriel <none@none>
Tue, 26 May 1992 18:09:11 +0000 (18:09 +0000)
committerceriel <none@none>
Tue, 26 May 1992 18:09:11 +0000 (18:09 +0000)
lang/cem/cemcom.ansi/domacro.c
lang/cem/cpp.ansi/domacro.c

index 973fd33..3722d85 100644 (file)
@@ -441,14 +441,16 @@ do_ifdef(how)
        push_if();
        if (!(id = GetIdentifier(1)))
                lexerror("illegal #ifdef construction");
+       else if (SkipToNewLine())
+               if (!options['o'])
+                       lexstrict("garbage following #%s <identifier>",
+                                 how ? "ifdef" : "ifndef");
 
        /* The next test is a shorthand for:
                (how && !id->id_macro) || (!how && id->id_macro)
        */
        if (how ^ (id && id->id_macro != 0))
                skip_block(0);
-       else if (id)
-               SkipToNewLine();
 }
 
 /* argidf != NULL when the undef came from a -U option */
index 99dbda6..633066f 100644 (file)
@@ -448,14 +448,17 @@ do_ifdef(how)
                id = findidf(str);
                free(str);
        }
+       if (SkipToNewLine()) {
+               if (str && !options['o'])
+                       strict("garbage following #%s <identifier>",
+                               how ? "ifdef" : "ifndef");
+       }
 
        /* The next test is a shorthand for:
                (how && !id->id_macro) || (!how && id->id_macro)
        */
        if (how ^ (id && id->id_macro != 0))
                skip_block(0);
-       else
-               SkipToNewLine();
 }
 
 /* argstr != NULL when the undef came from a -U option */