aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.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/cppinit.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/cppinit.c')
-rw-r--r--gcc/cppinit.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index f9bc306..7269c56 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -961,6 +961,11 @@ cpp_start_read (pfile, fname)
cpp_message (pfile, -1, "End of search list.\n");
}
+ /* Don't bother trying to do macro expansion if we've already done
+ preprocessing. */
+ if (opts->preprocessed)
+ pfile->no_macro_expand++;
+
/* Open the main input file.
We do this in nonblocking mode so we don't get stuck here if
someone clever has asked cpp to process /dev/rmt0;
@@ -988,7 +993,13 @@ cpp_start_read (pfile, fname)
ih_fake->limit = 0;
if (!finclude (pfile, f, ih_fake))
return 0;
- output_line_command (pfile, same_file);
+ if (opts->preprocessed)
+ /* If we've already processed this code, we want to trust the #line
+ directives in the input. But we still need to update our line
+ counter accordingly. */
+ pfile->lineno = CPP_BUFFER (pfile)->lineno;
+ else
+ output_line_command (pfile, same_file);
pfile->only_seen_white = 2;
/* The -imacros files can be scanned now, but the -include files
@@ -1155,6 +1166,10 @@ cpp_handle_option (pfile, argc, argv)
user_label_prefix = "_";
else if (!strcmp (argv[i], "-fno-leading-underscore"))
user_label_prefix = "";
+ else if (!strcmp (argv[i], "-fpreprocessed"))
+ opts->preprocessed = 1;
+ else if (!strcmp (argv[i], "-fno-preprocessed"))
+ opts->preprocessed = 0;
break;
case 'I': /* Add directory to path for includes. */