Kaydet (Commit) 2b97ae32 authored tarafından Noel Grandin's avatar Noel Grandin

rsc: remove unused OLD_PREPROCESSOR

and consequently unused
   OK_DOLLAR
   OK_CONCAT
   COMMENT_INVISIBLE
   STRING_FORMAL

Change-Id: I801b98be8a2fc04b7568fabff9aad486356a69c9
üst 80bdaac0
...@@ -209,12 +209,8 @@ typedef struct sizes { ...@@ -209,12 +209,8 @@ typedef struct sizes {
#ifdef nomacarg #ifdef nomacarg
#define cput output /* cput concatenates tokens */ #define cput output /* cput concatenates tokens */
#else #else
#if COMMENT_INVISIBLE
#define cput(c) { if (c != TOK_SEP && c != COM_SEP) PUTCHAR(c); }
#else
#define cput(c) { if (c != TOK_SEP) PUTCHAR(c); } #define cput(c) { if (c != TOK_SEP) PUTCHAR(c); }
#endif #endif
#endif
#ifndef nomacarg #ifndef nomacarg
#define streq(s1, s2) (strcmp(s1, s2) == 0) #define streq(s1, s2) (strcmp(s1, s2) == 0)
...@@ -340,11 +336,7 @@ void checkparm( int c, DEFBUF *dp ); ...@@ -340,11 +336,7 @@ void checkparm( int c, DEFBUF *dp );
int expcollect(void); int expcollect(void);
void expstuff( DEFBUF *dp ); void expstuff( DEFBUF *dp );
#if STRING_FORMAL
void stparmscan( int delim, DEFBUF *dp);
#else
void stparmscan( int delim); void stparmscan( int delim);
#endif
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
void dumpparm( char *why ); void dumpparm( char *why );
#endif #endif
......
...@@ -338,11 +338,7 @@ int MAIN(int argc, char** argv) ...@@ -338,11 +338,7 @@ int MAIN(int argc, char** argv)
if ((i = (ifptr - &ifstack[0])) != 0) if ((i = (ifptr - &ifstack[0])) != 0)
{ {
#if OLD_PREPROCESSOR
ciwarn("Inside #ifdef block at end of input, depth = %d", i);
#else
cierror("Inside #ifdef block at end of input, depth = %d", i); cierror("Inside #ifdef block at end of input, depth = %d", i);
#endif
} }
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
if( pDefOut != stdout && pDefOut != stderr ) if( pDefOut != stdout && pDefOut != stderr )
...@@ -458,9 +454,6 @@ void cppmain() ...@@ -458,9 +454,6 @@ void cppmain()
{ /* Token concat. loop */ { /* Token concat. loop */
for (counter = 0; type[(c = get())] == SPA;) for (counter = 0; type[(c = get())] == SPA;)
{ {
#if COMMENT_INVISIBLE
if (c != COM_SEP)
#endif
counter++; /* Skip over blanks */ counter++; /* Skip over blanks */
} }
...@@ -538,11 +531,7 @@ void cppmain() ...@@ -538,11 +531,7 @@ void cppmain()
*/ */
void output(int c) void output(int c)
{ {
#if COMMENT_INVISIBLE
if (c != TOK_SEP && c != COM_SEP)
#else
if (c != TOK_SEP) if (c != TOK_SEP)
#endif
PUTCHAR(c); PUTCHAR(c);
} }
...@@ -553,11 +542,7 @@ void output(int c) ...@@ -553,11 +542,7 @@ void output(int c)
*/ */
int outputEval(int c) int outputEval(int c)
{ {
#if COMMENT_INVISIBLE
if (c != TOK_SEP && c != COM_SEP)
#else
if (c != TOK_SEP) if (c != TOK_SEP)
#endif
{ {
PUTCHAR(c); PUTCHAR(c);
if ( bIsInEval && nEvalOff < NEVALBUF ) if ( bIsInEval && nEvalOff < NEVALBUF )
......
...@@ -280,19 +280,10 @@ nest_err: cerror("#%s must be in an #if", token); ...@@ -280,19 +280,10 @@ nest_err: cerror("#%s must be in an #if", token);
break; break;
} }
if (hash != L_include) { if (hash != L_include) {
#if OLD_PREPROCESSOR
/*
* Ignore the rest of the #control line so you can write
* #if foo
* #endif foo
*/
goto dump_line; /* Take common exit */
#else
if (skipws() != '\n') { if (skipws() != '\n') {
cwarn("Unexpected text in #control line ignored", NULLST); cwarn("Unexpected text in #control line ignored", NULLST);
skipnl(); skipnl();
} }
#endif
} }
return (counter + 1); return (counter + 1);
} }
...@@ -335,10 +326,8 @@ void doif(int hash) ...@@ -335,10 +326,8 @@ void doif(int hash)
return; return;
badif: cerror("#if, #ifdef, or #ifndef without an argument", NULLST); badif: cerror("#if, #ifdef, or #ifndef without an argument", NULLST);
#if !OLD_PREPROCESSOR
skipnl(); /* Prevent an extra */ skipnl(); /* Prevent an extra */
unget(); /* Error message */ unget(); /* Error message */
#endif
return; return;
} }
......
...@@ -127,18 +127,11 @@ void dodefine() ...@@ -127,18 +127,11 @@ void dodefine()
workp = work; /* Replacement put here */ workp = work; /* Replacement put here */
inmacro = TRUE; /* Keep \<newline> now */ inmacro = TRUE; /* Keep \<newline> now */
while (c != EOF_CHAR && c != '\n') { /* Compile macro body */ while (c != EOF_CHAR && c != '\n') { /* Compile macro body */
#if OK_CONCAT
#if COMMENT_INVISIBLE
if (c == COM_SEP) { /* Token concatenation? */
save(TOK_SEP); /* Stuff a delimiter */
c = get();
#else
if (c == '#') { /* Token concatenation? */ if (c == '#') { /* Token concatenation? */
while (workp > work && type[(int)workp[-1]] == SPA) while (workp > work && type[(int)workp[-1]] == SPA)
--workp; /* Erase leading spaces */ --workp; /* Erase leading spaces */
save(TOK_SEP); /* Stuff a delimiter */ save(TOK_SEP); /* Stuff a delimiter */
c = skipws(); /* Eat whitespace */ c = skipws(); /* Eat whitespace */
#endif
if (type[c] == LET) /* Another token here? */ if (type[c] == LET) /* Another token here? */
; /* Stuff it normally */ ; /* Stuff it normally */
else if (type[c] == DIG) { /* Digit string after? */ else if (type[c] == DIG) { /* Digit string after? */
...@@ -149,13 +142,10 @@ void dodefine() ...@@ -149,13 +142,10 @@ void dodefine()
save(TOK_SEP); /* Delimit 2nd token */ save(TOK_SEP); /* Delimit 2nd token */
} }
else { else {
#if ! COMMENT_INVISIBLE
ciwarn("Strange character after # (%d.)", c); ciwarn("Strange character after # (%d.)", c);
#endif
} }
continue; continue;
} }
#endif
switch (type[c]) { switch (type[c]) {
case LET: case LET:
checkparm(c, dp); /* Might be a formal */ checkparm(c, dp); /* Might be a formal */
...@@ -167,11 +157,7 @@ void dodefine() ...@@ -167,11 +157,7 @@ void dodefine()
break; break;
case QUO: /* String in mac. body */ case QUO: /* String in mac. body */
#if STRING_FORMAL
stparmscan(c, dp); /* Do string magic */
#else
stparmscan(c); stparmscan(c);
#endif
break; break;
case BSH: /* Backslash */ case BSH: /* Backslash */
...@@ -258,44 +244,6 @@ void checkparm(int c, DEFBUF* dp) ...@@ -258,44 +244,6 @@ void checkparm(int c, DEFBUF* dp)
save(*cp++); /* The token itself */ save(*cp++); /* The token itself */
} }
#if STRING_FORMAL
void stparmscan(delim, dp)
int delim;
DEFBUF *dp;
/*
* Scan the string (starting with the given delimiter).
* The token is replaced if it is the only text in this string or
* character constant. The algorithm follows checkparm() above.
* Note that scanstring() has approved of the string.
*/
{
int c;
/*
* Warning -- this code hasn't been tested for a while.
* It exists only to preserve compatibility with earlier
* implementations of cpp. It is not part of the Draft
* ANSI Standard C language.
*/
save(delim);
instring = TRUE;
while ((c = get()) != delim
&& c != '\n'
&& c != EOF_CHAR) {
if (type[c] == LET) /* Maybe formal parm */
checkparm(c, dp);
else {
save(c);
if (c == '\\')
save(get());
}
}
instring = FALSE;
if (c != delim)
cerror("Unterminated string in macro body", NULLST);
save(c);
}
#else
void stparmscan(int delim) void stparmscan(int delim)
/* /*
* Normal string parameter scan. * Normal string parameter scan.
...@@ -328,7 +276,6 @@ void stparmscan(int delim) ...@@ -328,7 +276,6 @@ void stparmscan(int delim)
} }
workp[-1] = wp[-1]; /* Nope, reset end quote. */ workp[-1] = wp[-1]; /* Nope, reset end quote. */
} }
#endif
void doundef() void doundef()
/* /*
......
...@@ -87,11 +87,7 @@ ...@@ -87,11 +87,7 @@
<< error type table is not correct >> << error type table is not correct >>
#endif #endif
#if OK_DOLLAR
#define DOL LET #define DOL LET
#else
#define DOL 000
#endif
#ifdef EBCDIC #ifdef EBCDIC
...@@ -211,11 +207,7 @@ skipws() ...@@ -211,11 +207,7 @@ skipws()
do { /* Skip whitespace */ do { /* Skip whitespace */
c = get(); c = get();
#if COMMENT_INVISIBLE
} while (type[c] == SPA || c == COM_SEP);
#else
} while (type[c] == SPA); } while (type[c] == SPA);
#endif
return (c); return (c);
} }
...@@ -273,7 +265,6 @@ catenate() ...@@ -273,7 +265,6 @@ catenate()
int c; int c;
char *token1; char *token1;
#if OK_CONCAT
if (get() != TOK_SEP) { /* Token concatenation */ if (get() != TOK_SEP) { /* Token concatenation */
unget(); unget();
return (FALSE); return (FALSE);
...@@ -301,12 +292,10 @@ catenate() ...@@ -301,12 +292,10 @@ catenate()
break; break;
default: /* An error, ... */ default: /* An error, ... */
#if ! COMMENT_INVISIBLE
if (isprint(c)) if (isprint(c))
cierror("Strange character '%c' after #", c); cierror("Strange character '%c' after #", c);
else else
cierror("Strange character (%d.) after #", c); cierror("Strange character (%d.) after #", c);
#endif
strcpy(work, token1); strcpy(work, token1);
unget(); unget();
break; break;
...@@ -321,9 +310,6 @@ catenate() ...@@ -321,9 +310,6 @@ catenate()
ungetstring(work); /* Unget the new thing, */ ungetstring(work); /* Unget the new thing, */
return (TRUE); return (TRUE);
} }
#else
return (FALSE); /* Not supported */
#endif
} }
int int
...@@ -927,14 +913,7 @@ newline: ...@@ -927,14 +913,7 @@ newline:
if (*file->bptr == '\n' if (*file->bptr == '\n'
|| type[*file->bptr & 0xFF] == SPA) || type[*file->bptr & 0xFF] == SPA)
goto newline; goto newline;
#if COMMENT_INVISIBLE
/*
* Return magic (old-fashioned) syntactic space.
*/
return ((file->bptr[-1] = COM_SEP));
#else
return ((file->bptr[-1] = ' ')); return ((file->bptr[-1] = ' '));
#endif
case '\n': /* we'll need a #line */ case '\n': /* we'll need a #line */
if (!keepcomments) if (!keepcomments)
...@@ -1036,11 +1015,7 @@ cget() ...@@ -1036,11 +1015,7 @@ cget()
do { do {
c = get(); c = get();
#if COMMENT_INVISIBLE
} while (c == TOK_SEP || c == COM_SEP);
#else
} while (c == TOK_SEP); } while (c == TOK_SEP);
#endif
return (c); return (c);
} }
......
...@@ -74,15 +74,6 @@ ...@@ -74,15 +74,6 @@
* to be marked "static" even though they are referenced * to be marked "static" even though they are referenced
* by "extern" statements elsewhere. * by "extern" statements elsewhere.
* *
* OK_DOLLAR Should be set TRUE if $ is a valid alphabetic character
* in identifiers (default), or zero if $ is invalid.
* Default is TRUE.
*
* OK_CONCAT Should be set TRUE if # may be used to concatenate
* tokens in macros (per the Ansi Draft Standard) or
* FALSE for old-style # processing (needed if cpp is
* to process assembler source code).
*
* OK_DATE Predefines the compilation date if set TRUE. * OK_DATE Predefines the compilation date if set TRUE.
* Not permitted by the Nov. 12, 1984 Draft Standard. * Not permitted by the Nov. 12, 1984 Draft Standard.
* *
...@@ -115,24 +106,6 @@ ...@@ -115,24 +106,6 @@
#define LINE_PREFIX "" #define LINE_PREFIX ""
#endif #endif
/*
* OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
* COMMENT_INVISIBLE, and STRING_FORMAL to values appropriate for
* an old-style preprocessor.
*/
#ifndef OLD_PREPROCESSOR
#define OLD_PREPROCESSOR FALSE
#endif
#if OLD_PREPROCESSOR
#define OK_DOLLAR FALSE
#define OK_CONCAT TRUE
#define COMMENT_INVISIBLE TRUE
#define STRING_FORMAL TRUE
#define IDMAX 63 /* actually, seems to be unlimited */
#endif
/* /*
* RECURSION_LIMIT may be set to -1 to disable the macro recursion test. * RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
*/ */
...@@ -148,45 +121,6 @@ ...@@ -148,45 +121,6 @@
#define BITS_CHAR 8 #define BITS_CHAR 8
#endif #endif
/*
* COMMENT_INVISIBLE may be defined to allow "old-style" comment
* processing, whereby the comment becomes a zero-length token
* delimiter. This permitted tokens to be concatenated in macro
* expansions. This was removed from the Draft Ansi Standard.
*/
#ifndef COMMENT_INVISIBLE
#define COMMENT_INVISIBLE FALSE
#endif
/*
* STRING_FORMAL may be defined to allow recognition of macro parameters
* anywhere in replacement strings. This was removed from the Draft Ansi
* Standard and a limited recognition capability added.
*/
#ifndef STRING_FORMAL
#define STRING_FORMAL FALSE
#endif
/*
* OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
* This is a permitted extension to the Ansi Standard and is required
* for e.g., RSX-11M, etc. It should be set FALSE if cpp is
* used to preprocess assembler source on Unix systems. OLD_PREPROCESSOR
* sets OK_DOLLAR FALSE for that reason.
*/
#ifndef OK_DOLLAR
#define OK_DOLLAR TRUE
#endif
/*
* OK_CONCAT enables (one possible implementation of) token concatenation.
* If cpp is used to preprocess Unix assembler source, this should be
* set FALSE as the concatenation character, #, is used by the assembler.
*/
#ifndef OK_CONCAT
#define OK_CONCAT TRUE
#endif
/* /*
* OK_DATE may be enabled to predefine today's date as a string * OK_DATE may be enabled to predefine today's date as a string
* at the start of each compilation. This is apparently not permitted * at the start of each compilation. This is apparently not permitted
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment