summaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-06 23:12:30 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-06 23:12:30 +0000
commite920deaf1748fdced02a6fdd586c792e67d8511a (patch)
tree67d3347376b5ce3e8f6b568c099d8391313de175 /gcc/c-opts.c
parentef95318d7471ed79c5ed341a48668c9239964907 (diff)
downloadgcc-e920deaf1748fdced02a6fdd586c792e67d8511a.tar.gz
* Makefile.in (c-ppoutput.o): Update.
* c-common.h (init_pp_output): New. (preprocess_file): Update. * c-lex.c (init_c_lex): Move mbchar initialization to cpplib. Register builtins. * c-opts.c (c_common_init): Call init_pp_output if preprocessing. Make call to cpp_read_main_file common to whether preprocessing or not. Don't register builtins. * c-ppoutput.c: Include c-pragma.h. (setup_callbacks): Rename init_pp_output. (preprocess_file): No longer setup callbacks or call cpp_read_main_file. * cpphash.h (_cpp_init_mbchar): New. * cppinit.c (init_library): Call _cpp_init_mbchar. * cpplex.c (_cpp_init_mbchar): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63913 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 97ba6cc5b92..ebf22d7d972 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -1512,10 +1512,6 @@ c_common_init (filename)
cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
cpp_opts->unsigned_wchar = TREE_UNSIGNED (wchar_type_node);
- /* Register preprocessor built-ins before calls to
- cpp_main_file. */
- cpp_get_callbacks (parse_in)->register_builtins = cb_register_builtins;
-
if (flag_preprocess_only)
{
/* Open the output now. We must do so even if flag_no_output is
@@ -1527,23 +1523,31 @@ c_common_init (filename)
out_stream = fopen (out_fname, "w");
if (out_stream == NULL)
- fatal_io_error ("opening output file %s", out_fname);
- else
- /* Preprocess the input file to out_stream. */
- preprocess_file (parse_in, in_fname, out_stream);
+ {
+ fatal_io_error ("opening output file %s", out_fname);
+ return NULL;
+ }
- /* Exit quickly in toplev.c. */
- return NULL;
+ init_pp_output (out_stream);
}
+ else
+ {
+ init_c_lex ();
- init_c_lex ();
-
- /* Start it at 0. */
- lineno = 0;
+ /* Yuk. WTF is this? I do know ObjC relies on it somewhere. */
+ lineno = 0;
+ }
/* NOTE: we use in_fname here, not the one supplied. */
filename = cpp_read_main_file (parse_in, in_fname, ident_hash);
+ if (flag_preprocess_only)
+ {
+ if (filename)
+ preprocess_file (parse_in);
+ return NULL;
+ }
+
/* Has to wait until now so that cpplib has its hash table. */
init_pragma ();