From 373e217703ba0c771832fb8f634c98022f5be353 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 21 Feb 2001 07:29:56 +0000 Subject: cppfiles.c: Update comments. * cppfiles.c: Update comments. (_cpp_read_file): Don't check for NULL filenames any more. * cppinit.c (cpp_start_read): Don't do canonicalization of in_fname and out_fname. Use the passed file name exclusively. (_cpp_handle_options): Don't treat "-" as a command line option, but as a normal filename. (_cpp_post_options): Canonicalize in_fname and out_fname. * cppmain.c (printer_init): Don't check out_fname for NULL. * c-lex.c (orig_filename): Rename cpp_filename for clarity. (init_c_lex): Update, and use "" to represent stdin to CPP. (yyparse): Update. From-SVN: r39938 --- gcc/c-lex.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc/c-lex.c') diff --git a/gcc/c-lex.c b/gcc/c-lex.c index c147648..9078361 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -53,8 +53,8 @@ Boston, MA 02111-1307, USA. */ #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME)) #endif -/* The original file name, before changing "-" to "stdin". */ -static const char *orig_filename; +/* The input filename as understood by CPP, where "" represents stdin. */ +static const char *cpp_filename; /* We may keep statistics about how long which files took to compile. */ static int header_time, body_time; @@ -102,8 +102,6 @@ init_c_lex (filename) struct cpp_callbacks *cb; 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, @@ -136,8 +134,11 @@ init_c_lex (filename) cb->undef = cb_undef; } + if (filename == 0 || !strcmp (filename, "-")) - filename = "stdin"; + filename = "stdin", cpp_filename = ""; + else + cpp_filename = filename; /* Start it at 0. */ lineno = 0; @@ -151,7 +152,7 @@ init_c_lex (filename) int yyparse() { - if (! cpp_start_read (parse_in, orig_filename)) + if (! cpp_start_read (parse_in, cpp_filename)) return 1; /* cpplib has emitted an error. */ return yyparse_1(); -- cgit v1.1