Fix '#undef' handling

This commit is contained in:
ceriel 1991-12-16 14:06:09 +00:00
parent dc44eba062
commit 950e26815e
5 changed files with 31 additions and 24 deletions

View file

@ -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

View file

@ -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 */

View file

@ -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");

View file

@ -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 */

View file

@ -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