diff options
author | Neil Booth <neil@gcc.gnu.org> | 2001-01-11 21:30:16 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-01-11 21:30:16 +0000 |
commit | 05e817242739f61b792b0730712e512ba25256b5 (patch) | |
tree | ccce935ca0e9dc123a10800c572cceabc8074b67 /gcc/cppinit.c | |
parent | 76d06edcf6c741801b51ecf31a48f262c8f85c52 (diff) | |
download | gcc-05e817242739f61b792b0730712e512ba25256b5.zip gcc-05e817242739f61b792b0730712e512ba25256b5.tar.gz gcc-05e817242739f61b792b0730712e512ba25256b5.tar.bz2 |
[multiple changes]
2001-01-11 Neil Booth <neil@daikokuya.demon.co.uk>
* cppinit.c (cpp_start_read): If -fpreprocessed, ignore
-D, -U and -A, and don't initialize the builtins.
* cppmain.c (cb_define, cb_undef): Unconditionally process
the callback.
* tradcpp.c (main): Fix typo.
2000-01-11 Mark Elbrecht <snowball3@bigfoot.com>
* cppfiles.c (cpp_included, find_include_file, _cpp_execute_include)
(read_name_map): Use IS_ABSOLUTE_PATH.
* tradcpp.c (get_filename): Likewise.
From-SVN: r38925
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r-- | gcc/cppinit.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c index 0a7fe48..b7cbbf2 100644 --- a/gcc/cppinit.c +++ b/gcc/cppinit.c @@ -849,9 +849,11 @@ do_includes (pfile, p, scan) { struct pending_option *q; - /* Later: maybe update this to use the #include "" search path - if cpp_read_file fails. */ - if (_cpp_read_file (pfile, p->arg) && scan) + /* Don't handle if -fpreprocessed. Later: maybe update this to + use the #include "" search path if cpp_read_file fails. */ + if (! CPP_OPTION (pfile, preprocessed)) + cpp_error (pfile, "-include and -imacros cannot be used with -fpreprocessed"); + else if (_cpp_read_file (pfile, p->arg) && scan) cpp_scan_buffer_nooutput (pfile, 0); q = p->next; free (p); @@ -859,10 +861,9 @@ do_includes (pfile, p, scan) } } -/* This is called after options have been processed. Check options - for consistency, and setup for processing input from the file named - FNAME. (Use standard input if FNAME == NULL.) Return 1 on success, - 0 on failure. */ +/* This is called after options have been processed. Setup for + processing input from the file named FNAME. (Use standard input if + FNAME == NULL.) Return 1 on success, 0 on failure. */ int cpp_start_read (pfile, fname) @@ -915,18 +916,22 @@ cpp_start_read (pfile, fname) if (!_cpp_read_file (pfile, fname)) return 0; - /* Install __LINE__, etc. */ - init_builtins (pfile); + /* If already preprocessed, don't install __LINE__, etc., and ignore + command line definitions and assertions. Handle -U's, -D's and + -A's in the order they were seen. */ + if (! CPP_OPTION (pfile, preprocessed)) + init_builtins (pfile); - /* Do -U's, -D's and -A's in the order they were seen. */ p = CPP_OPTION (pfile, pending)->directive_head; while (p) { - (*p->handler) (pfile, p->arg); + if (! CPP_OPTION (pfile, preprocessed)) + (*p->handler) (pfile, p->arg); q = p->next; free (p); p = q; } + pfile->done_initializing = 1; /* The -imacros files can be scanned now, but the -include files @@ -1131,10 +1136,10 @@ static const struct cl_option cl_options[] = command-line matches. Returns its index in the option array, negative on failure. Complications arise since some options can be suffixed with an argument, and multiple complete matches can occur, - e.g. -iwithprefix and -iwithprefixbefore. Moreover, we want to - accept options beginning with -g and -W that we do not recognise, - but not to swallow any subsequent command line argument; these are - handled as special cases in cpp_handle_option. */ + e.g. -iwithprefix and -iwithprefixbefore. Moreover, we need to + accept options beginning with -W that we do not recognise, but not + to swallow any subsequent command line argument; this is handled as + special cases in cpp_handle_option. */ static int parse_option (input) const char *input; |