diff options
author | Richard Henderson <rth@gcc.gnu.org> | 2000-11-20 23:39:52 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2000-11-20 23:39:52 -0800 |
commit | 3aac38d70cbb15e40c377d39dd612df4d16ad259 (patch) | |
tree | bf302f0b96b0df7401aed3a7535da9fbf23c5932 /gcc/c-lex.c | |
parent | 66bc5940f137cfe9a38e37c2619189604fd246b7 (diff) | |
download | gcc-3aac38d70cbb15e40c377d39dd612df4d16ad259.zip gcc-3aac38d70cbb15e40c377d39dd612df4d16ad259.tar.gz gcc-3aac38d70cbb15e40c377d39dd612df4d16ad259.tar.bz2 |
parse.y (yyparse_1): Rename the parser entry point.
* cp/parse.y (yyparse_1): Rename the parser entry point.
* c-lex.c (orig_filename): New variable.
(init_c_lex): Set it. Move call to cpp_start_read ...
(yyparse): ... here. New function.
* c-parse.in (yyparse_1): Rename the parser entry point.
* c-tree.h: Declare it.
From-SVN: r37607
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r-- | gcc/c-lex.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c index faa8e59..4f9b8cc 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -60,6 +60,9 @@ extern cpp_reader parse_in; FILE *finput; #endif +/* The original file name, before changing "-" to "stdin". */ +static const char *orig_filename; + /* Private idea of the line number. See discussion in c_lex(). */ static int lex_lineno; @@ -170,6 +173,8 @@ init_c_lex (filename) { struct c_fileinfo *toplevel; + orig_filename = filename; + /* Set up filename timing. Must happen before cpp_start_read. */ file_info_tree = splay_tree_new ((splay_tree_compare_fn)strcmp, 0, @@ -214,9 +219,6 @@ init_c_lex (filename) /* Make sure parse_in.digraphs matches flag_digraphs. */ CPP_OPTION (&parse_in, digraphs) = flag_digraphs; - if (! cpp_start_read (&parse_in, filename)) - exit (FATAL_EXIT_CODE); /* cpplib has emitted an error. */ - if (filename == 0 || !strcmp (filename, "-")) filename = "stdin"; #endif @@ -232,6 +234,18 @@ init_c_lex (filename) return filename; } +/* A thin wrapper around the real parser that initializes the + integrated preprocessor after debug output has been initialized. */ + +int +yyparse() +{ + if (! cpp_start_read (&parse_in, orig_filename)) + return 1; /* cpplib has emitted an error. */ + + return yyparse_1(); +} + struct c_fileinfo * get_fileinfo (name) const char *name; |