From 1de983200b9be46137451177ae66e7ea14f766ac Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 26 May 1992 18:09:11 +0000 Subject: [PATCH] Fixed bug in '#ifdef FALSE || 1 (garbage) --- lang/cem/cemcom.ansi/domacro.c | 6 ++++-- lang/cem/cpp.ansi/domacro.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 973fd333e..3722d856b 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -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 ", + 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 */ diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index 99dbda67d..633066f18 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -448,14 +448,17 @@ do_ifdef(how) id = findidf(str); free(str); } + if (SkipToNewLine()) { + if (str && !options['o']) + strict("garbage following #%s ", + 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 */ -- 2.34.1