From 950e26815e93368ec6261142837f024a8b6c101a Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 16 Dec 1991 14:06:09 +0000 Subject: [PATCH] Fix '#undef' handling --- lang/cem/cemcom.ansi/BigPars | 16 ++++++++-------- lang/cem/cemcom.ansi/SmallPars | 24 ++++++++++++------------ lang/cem/cemcom.ansi/domacro.c | 6 +++++- lang/cem/cpp.ansi/Parameters | 4 ++-- lang/cem/cpp.ansi/domacro.c | 5 ++++- 5 files changed, 31 insertions(+), 24 deletions(-) diff --git a/lang/cem/cemcom.ansi/BigPars b/lang/cem/cemcom.ansi/BigPars index 31f7540bc..a86aeda20 100644 --- a/lang/cem/cemcom.ansi/BigPars +++ b/lang/cem/cemcom.ansi/BigPars @@ -1,5 +1,5 @@ !File: lint.h -#undef LINT 1 /* if defined, 'lint' is produced */ +/*#define LINT 1 /* if defined, 'lint' is produced */ !File: pathlength.h @@ -75,7 +75,7 @@ !File: botch_free.h -#undef BOTCH_FREE 1 /* when defined, botch freed memory, as a check */ +/*#define BOTCH_FREE 1 /* when defined, botch freed memory, as a check */ !File: dataflow.h @@ -83,7 +83,7 @@ !File: debug.h -#undef DEBUG 1 /* perform various self-tests */ +/*#define DEBUG 1 /* perform various self-tests */ !File: use_tmp.h @@ -111,17 +111,17 @@ !File: nopp.h -#undef NOPP 1 /* if NOT defined, use built-int preprocessor */ +/*#define NOPP 1 /* if NOT defined, use built-int preprocessor */ !File: nobitfield.h -#undef NOBITFIELD 1 /* if NOT defined, implement bitfields */ +/*#define NOBITFIELD 1 /* if NOT defined, implement bitfields */ !File: spec_arith.h /* describes internal compiler arithmetics */ #undef SPECIAL_ARITHMETICS /* something different from native long */ -#undef UNSIGNED_ARITH unsigned arith +/*#define UNSIGNED_ARITH unsigned arith /* if it is supported */ !File: static.h @@ -129,11 +129,11 @@ !File: nocross.h -#undef NOCROSS 1 /* if NOT defined, cross compiler */ +/*#define NOCROSS 1 /* if NOT defined, cross compiler */ !File: regcount.h -#undef REGCOUNT 1 /* count occurrences for register messages */ +/*#define REGCOUNT 1 /* count occurrences for register messages */ !File: dbsymtab.h diff --git a/lang/cem/cemcom.ansi/SmallPars b/lang/cem/cemcom.ansi/SmallPars index 5d9c4a1dd..961431566 100644 --- a/lang/cem/cemcom.ansi/SmallPars +++ b/lang/cem/cemcom.ansi/SmallPars @@ -1,5 +1,5 @@ !File: lint.h -#undef LINT 1 /* if defined, 'lint' is produced */ +/*#define LINT 1 /* if defined, 'lint' is produced */ !File: pathlength.h @@ -75,23 +75,23 @@ !File: botch_free.h -#undef BOTCH_FREE 1 /* when defined, botch freed memory, as a check */ +/*#define BOTCH_FREE 1 /* when defined, botch freed memory, as a check */ !File: dataflow.h -#undef DATAFLOW 1 /* produce some compile-time xref */ +/*#define DATAFLOW 1 /* produce some compile-time xref */ !File: debug.h -#undef DEBUG 1 /* perform various self-tests */ +/*#define DEBUG 1 /* perform various self-tests */ !File: use_tmp.h -#undef PREPEND_SCOPES 1 /* collect exa, exp, ina and inp commands +/*#define PREPEND_SCOPES 1 /* collect exa, exp, ina and inp commands and if USE_TMP is defined let them precede the rest of the generated compact code */ -#undef USE_TMP 1 /* use C_insertpart, C_endpart mechanism +/*#define USE_TMP 1 /* use C_insertpart, C_endpart mechanism to generate EM-code in the order needed for the code-generators. If not defined, the old-style peephole optimizer is @@ -107,7 +107,7 @@ !File: inputtype.h -#undef INP_READ_IN_ONE 1 /* read input file in one */ +/*#define INP_READ_IN_ONE 1 /* read input file in one */ !File: nopp.h @@ -115,13 +115,13 @@ !File: nobitfield.h -#undef NOBITFIELD 1 /* if NOT defined, implement bitfields */ +/*#define NOBITFIELD 1 /* if NOT defined, implement bitfields */ !File: spec_arith.h /* describes internal compiler arithmetics */ #undef SPECIAL_ARITHMETICS /* something different from native long */ -#undef UNSIGNED_ARITH unsigned arith +/*#define UNSIGNED_ARITH unsigned arith /* if it is supported */ !File: static.h @@ -129,14 +129,14 @@ !File: nocross.h -#undef NOCROSS 1 /* if NOT defined, cross compiler */ +/*#define NOCROSS 1 /* if NOT defined, cross compiler */ !File: regcount.h -#undef REGCOUNT 1 /* count occurrences for register messages */ +/*#define REGCOUNT 1 /* count occurrences for register messages */ !File: dbsymtab.h -#undef DBSYMTAB 1 /* ability to produce symbol table for debugger */ +/*#define DBSYMTAB 1 /* ability to produce symbol table for debugger */ diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c index 83e7d3269..bf93d95c3 100644 --- a/lang/cem/cemcom.ansi/domacro.c +++ b/lang/cem/cemcom.ansi/domacro.c @@ -468,7 +468,11 @@ do_undef(argidf) id->id_macro = (struct macro *) 0; } } /* else: don't complain */ - if (!argidf) SkipToNewLine(); + if (!argidf) { + if (SkipToNewLine()) + if (!options['o']) + lexstrict("garbage following #undef"); + } } else lexerror("illegal #undef construction"); diff --git a/lang/cem/cpp.ansi/Parameters b/lang/cem/cpp.ansi/Parameters index a15815885..59c99db5f 100644 --- a/lang/cem/cpp.ansi/Parameters +++ b/lang/cem/cpp.ansi/Parameters @@ -36,7 +36,7 @@ !File: botch_free.h -#undef BOTCH_FREE 1 /* botch freed memory, as a check */ +/*#define BOTCH_FREE 1 /* botch freed memory, as a check */ !File: debug.h @@ -52,7 +52,7 @@ !File: inputtype.h -#undef INP_READ_IN_ONE 1 /* read input file in one. */ +/*#define INP_READ_IN_ONE 1 /* read input file in one. */ /* If defined, we cannot read from a pipe */ diff --git a/lang/cem/cpp.ansi/domacro.c b/lang/cem/cpp.ansi/domacro.c index 5e6875317..99dbda67d 100644 --- a/lang/cem/cpp.ansi/domacro.c +++ b/lang/cem/cpp.ansi/domacro.c @@ -478,7 +478,10 @@ do_undef(argstr) } /* else: don't complain */ if (!argstr){ free(str); - SkipToNewLine(); + if (SkipToNewLine()) { + if (!options['o']) + strict("garbage following #else"); + } } } else -- 2.34.1