diff options
author | Richard Stallman <rms@gnu.org> | 1992-07-01 02:34:39 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-07-01 02:34:39 +0000 |
commit | ca5b800aa27c07962b2a7c855d3842e64126988a (patch) | |
tree | b9a1983a4e5cdec5c7f5bfc894d92127ffb2db17 | |
parent | 4c41bbfa769371a67cae3de8256c8da2b4d02385 (diff) | |
download | gcc-ca5b800aa27c07962b2a7c855d3842e64126988a.zip gcc-ca5b800aa27c07962b2a7c855d3842e64126988a.tar.gz gcc-ca5b800aa27c07962b2a7c855d3842e64126988a.tar.bz2 |
(check_newline): Support HANDLE_SYSV_PRAGMA.
(handle_sysv_pragma): New function.
From-SVN: r1367
-rw-r--r-- | gcc/c-lex.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 3611efb..75a7f4d 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -481,6 +481,15 @@ check_newline () && getc (finput) == 'a' && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n')) { +#ifdef HANDLE_SYSV_PRAGMA + c = handle_sysv_pragma (finput, c); + if (c >= 0) + ; + else if (nextchar >= 0) + c = nextchar, nextchar = -1; + else + c = getc (finput); +#endif /* HANDLE_SYSV_PRAGMA */ #ifdef HANDLE_PRAGMA HANDLE_PRAGMA (finput); #endif /* HANDLE_PRAGMA */ @@ -729,6 +738,45 @@ linenum: return c; } +#ifdef HANDLE_SYSV_PRAGMA + +/* Handle a #pragma directive. INPUT is the current input stream, + and C is a character to reread. + Returns a character for the caller to reread, + or -1 meaning there isn't one. */ + +/* This function has to be in this file, in order to get at + the token types. */ + +int +handle_sysv_pragma (input, c) + FILE *input; + int c; +{ + while (c == ' ' || c == '\t') + c = getc (input); + if (c == '\n' || c == EOF) + { + handle_pragma_token (0, 0); + return c; + } + ungetc (c, input); + switch (yylex ()) + { + case IDENTIFIER: + case TYPENAME: + case STRING: + case CONSTANT: + handle_pragma_token (token_buffer, yylval.ttype); + break; + default: + handle_pragma_token (token_buffer, 0); + } + return -1; +} + +#endif /* HANDLE_SYSV_PRAGMA */ + #define isalnum(char) ((char >= 'a' && char <= 'z') || (char >= 'A' && char <= 'Z') || (char >= '0' && char <= '9')) #define isdigit(char) (char >= '0' && char <= '9') #define ENDFILE -1 /* token that represents end-of-file */ |