Fix '#undef' handling
authorceriel <none@none>
Mon, 16 Dec 1991 14:06:09 +0000 (14:06 +0000)
committerceriel <none@none>
Mon, 16 Dec 1991 14:06:09 +0000 (14:06 +0000)
lang/cem/cemcom.ansi/BigPars
lang/cem/cemcom.ansi/SmallPars
lang/cem/cemcom.ansi/domacro.c
lang/cem/cpp.ansi/Parameters
lang/cem/cpp.ansi/domacro.c

index 31f7540..a86aeda 100644 (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
 
 
 !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
 
 
 !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
index 5d9c4a1..9614315 100644 (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
 
 
 !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
 
 
 !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
 
 
 !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
 
 
 !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 */
 
 
index 83e7d32..bf93d95 100644 (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");
index a158158..59c99db 100644 (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 */
 
 
index 5e68753..99dbda6 100644 (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