[6423] in Athena Bugs
/lib/cpp #error support
daemon@ATHENA.MIT.EDU (John Carr)
Sun Nov 18 17:42:46 1990
To: bugs@ATHENA.MIT.EDU
Date: Sun, 18 Nov 90 17:42:34 EST
From: John Carr <jfc@ATHENA.MIT.EDU>
This change to /lib/cpp makes it understand the "#error" directive:
*** /source/bsd-4.3/rt/lib/cpp/cpp.c Sun Jul 15 15:43:02 1990
--- cpp.c Sun Nov 18 17:32:34 1990
***************
*** 215,220 ****
--- 215,221 ----
STATIC struct symtab *lneloc;
STATIC struct symtab *ulnloc;
STATIC struct symtab *uflloc;
+ STATIC struct symtab *errloc;
STATIC struct symtab *identloc; /* Sys 5r3 compatibility */
STATIC int trulvl;
STATIC int flslvl;
***************
*** 863,868 ****
--- 864,878 ----
}
} else if (np==identloc) {/* ident (for Sys 5r3 compat) */
while(*inp!='\n') p=cotoken(p);
+ } else if(np==errloc) { /* #error */
+ if(flslvl == 0) {
+ fprintf(stderr, "Error: ");
+ inp += 6;
+ while(*++inp!='\n')
+ fputc(*inp, stderr);
+ fputc('\n', stderr);
+ ++exfail;
+ }
} else if (*++inp=='\n') outp=inp; /* allows blank line after # */
else pperror("undefined control",0);
/* flush to lf */
***************
*** 1263,1268 ****
--- 1273,1279 ----
ifnloc=ppsym("ifndef");
ifloc=ppsym("if");
lneloc=ppsym("line");
+ errloc=ppsym("error");
identloc=ppsym("ident"); /* Sys 5r3 compatibility */
for (i=sizeof(macbit)/sizeof(macbit[0]); --i>=0; ) macbit[i]=0;
# if unix