aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2001-11-15 10:01:10 +0000
committerNeil Booth <neil@gcc.gnu.org>2001-11-15 10:01:10 +0000
commitf5e99456f19b80978984f781e1d847b90d09b30a (patch)
treecac90266aeb52525edc15fddc73e9428ce8a8556 /gcc/c-lex.c
parent87bc7fa6aab909eb842be0800e0284b0daa3de70 (diff)
downloadgcc-f5e99456f19b80978984f781e1d847b90d09b30a.zip
gcc-f5e99456f19b80978984f781e1d847b90d09b30a.tar.gz
gcc-f5e99456f19b80978984f781e1d847b90d09b30a.tar.bz2
c-common.c: Include c-lex.h.
* c-common.c: Include c-lex.h. (c_common_lang_init): Change prototype. Call init_c_lex and init_pragma from here. * c-common.h (c_common_lang_init): Change prototype. * c-decl.c (init_decl_processing): Rename. Call c_parse_init. * c-lang.c (c_init): Change prototype. Update. (c_init_options): Update. * c-lex.c (cpp_filename): Remove. (init_c_lex): Update. Read the main file, and get the original file name. (yyparse): Finish the command line options. * c-parse.in (c_parse_init): Call init_reswords here. (init_parse): Remove. * c-tree.h (c_init_decl_processing): New. * cpphash.c (_cpp_init_hashtable): After initializing the hash table, populate it. * cppinit.c (read_original_filename, cpp_finish_options): New. (cpp_create_reader): New prototype. Defer hash table initialization. (cpp_start_read): Rename cpp_read_main_file. Initialize the hash table. Get the original filename. * cpplib.h (cpp_create_reader): Update. (cpp_start_read): Remove. (cpp_read_main_file, cpp_finish_options): New. * cppmain.c (main, do_preprocessing): Update. * langhooks.h (struct langhooks): Update init prototype. * toplev.c (general_init, parse_options_and_default_flags, process_options, lang_indpendent_init, lang_dependent_init, init_asm_output): New; perform the bulk of initialization. (compile_file): Move most of initialization to above functions. (debug_hooks): Initialize statically. (set_Wunused): Relocate. (toplev_main): Move most of initialization to other init functions. Have a clear logic flow. * tree.h (init_parse, init_decl_processing): Remove. ada: * misc.c (gnat_init): Change prototype. Include the functionality of the old init_parse and init_decl_processing. (gnat_init_decl_processing): New prototype. (init_parse): Remove. * utils.c (init_decl_processing): Rename gnat_init_decl_processing. cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New. (cxx_init): Update prototype. * decl.c (init_decl_processing): Rename. Move null node init to its creation time. * lex.c (cxx_init_options): Update. (cxx_init): Combine with old init_parse; also call cxx_init_decl_processing. f: * com.c (ffecom_init_decl_processing): Renamed from init_decl_processing. (init_parse): Move contents to ffe_init. (ffe_init): Update prototype. java: * decl.c (init_decl_processing): Rename java_init_decl_processing. * java-tree.h: New prototype. * lang.c (java_init): Update prototype. Combine with old init_parse. objc: * objc-act.c (objc_init): Update prototype, combine with old init_parse. (objc_init_options): Update. From-SVN: r47046
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index ca59266..ea824ec 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -54,9 +54,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME))
#endif
-/* The input filename as understood by CPP, where "" represents stdin. */
-static const char *cpp_filename;
-
/* The current line map. */
static const struct line_map *map;
@@ -109,7 +106,7 @@ init_c_lex (filename)
struct cpp_callbacks *cb;
struct c_fileinfo *toplevel;
- /* Set up filename timing. Must happen before cpp_start_read. */
+ /* Set up filename timing. Must happen before cpp_read_main_file. */
file_info_tree = splay_tree_new ((splay_tree_compare_fn)strcmp,
0,
(splay_tree_delete_value_fn)free);
@@ -142,16 +139,13 @@ init_c_lex (filename)
cb->undef = cb_undef;
}
-
- if (filename == 0 || !strcmp (filename, "-"))
- filename = "stdin", cpp_filename = "";
- else
- cpp_filename = filename;
-
/* Start it at 0. */
lineno = 0;
- return filename;
+ if (filename == NULL)
+ filename = "";
+
+ return cpp_read_main_file (parse_in, filename, ident_hash);
}
/* A thin wrapper around the real parser that initializes the
@@ -160,8 +154,7 @@ init_c_lex (filename)
int
yyparse()
{
- if (! cpp_start_read (parse_in, cpp_filename))
- return 1; /* cpplib has emitted an error. */
+ cpp_finish_options (parse_in);
return yyparse_1();
}