aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1999-07-20 15:13:01 -0400
committerJason Merrill <jason@gcc.gnu.org>1999-07-20 15:13:01 -0400
commit3773a46b934e6d5a8a0803409a813dbfba5b46bc (patch)
treef7bd40b9e6c61ade2fdde4c0b13b88e694cb8882 /gcc/cpplib.c
parentc8649fde97502156b0896b622c8c52f464d16db3 (diff)
downloadgcc-3773a46b934e6d5a8a0803409a813dbfba5b46bc.zip
gcc-3773a46b934e6d5a8a0803409a813dbfba5b46bc.tar.gz
gcc-3773a46b934e6d5a8a0803409a813dbfba5b46bc.tar.bz2
gcc.c (default_compilers, cpp-output): Pass -fpreprocessed.
* gcc.c (default_compilers, cpp-output): Pass -fpreprocessed. * toplev.c (documented_lang_options): Add -fpreprocessed. * cpplib.h (struct cpp_buffer): Add preprocessed. * cppinit.c (cpp_handle_option): Handle -fpreprocessed. (cpp_start_read): Don't expand macros or emit an initial #line directive if -fpreprocessed. * cpplib.h (struct cpp_buffer): Added manual_pop for better C++ tokenization. * cpplib.c (cpp_get_token): Return CPP_EOF if manual_pop. Also, support C++ tokenization for ->*, .*, <?, and >? operators. * c-common.c (cpp_token): Make non-static. From-SVN: r28190
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 25b57c6..efd87e1 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -2029,7 +2029,10 @@ cpp_get_token (pfile)
handle_eof:
if (CPP_BUFFER (pfile)->seen_eof)
{
- if (CPP_PREV_BUFFER (CPP_BUFFER (pfile)) == CPP_NULL_BUFFER (pfile))
+ if (CPP_PREV_BUFFER (CPP_BUFFER (pfile)) == CPP_NULL_BUFFER (pfile)
+ /* If we've been reading from redirected input, the
+ frontend will pop the buffer. */
+ || CPP_BUFFER (pfile)->manual_pop)
return CPP_EOF;
cpp_pop_buffer (pfile);
@@ -2172,8 +2175,25 @@ cpp_get_token (pfile)
c2 = PEEKC ();
if (c2 == '-' && opts->chill)
goto comment; /* Chill style comment */
- if (c2 == '-' || c2 == '=' || c2 == '>')
+ if (c2 == '-' || c2 == '=')
goto op2;
+ if (c2 == '>')
+ {
+ if (opts->cplusplus && PEEKN (1) == '*')
+ {
+ /* In C++, there's a ->* operator. */
+ op3:
+ token = CPP_OTHER;
+ pfile->only_seen_white = 0;
+ CPP_RESERVE (pfile, 4);
+ CPP_PUTC_Q (pfile, c);
+ CPP_PUTC_Q (pfile, GETC ());
+ CPP_PUTC_Q (pfile, GETC ());
+ CPP_NUL_TERMINATE_Q (pfile);
+ return token;
+ }
+ goto op2;
+ }
goto randomchar;
case '<':
@@ -2219,7 +2239,8 @@ cpp_get_token (pfile)
c2 = PEEKC ();
if (c2 == '=')
goto op2;
- if (c2 != c)
+ /* GNU C++ supports MIN and MAX operators <? and >?. */
+ if (c2 != c && (!opts->cplusplus || c2 != '?'))
goto randomchar;
FORWARD(1);
CPP_RESERVE (pfile, 4);
@@ -2241,6 +2262,11 @@ cpp_get_token (pfile)
c = GETC ();
goto number;
}
+
+ /* In C++ there's a .* operator. */
+ if (opts->cplusplus && c2 == '*')
+ goto op2;
+
if (c2 == '.' && PEEKN(1) == '.')
{
CPP_RESERVE(pfile, 4);
@@ -2549,7 +2575,7 @@ parse_name (pfile, c)
/* Parse a string starting with C. A single quoted string is treated
like a double -- some programs (e.g., troff) are perverse this way.
(However, a single quoted string is not allowed to extend over
- multiple lines. */
+ multiple lines.) */
static void
parse_string (pfile, c)
cpp_reader *pfile;