diff options
author | Zack Weinberg <zack@rabi.phys.columbia.edu> | 1998-09-30 18:15:13 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-09-30 12:15:13 -0600 |
commit | 6fa72945c91260ee27d445fb87f4162032307180 (patch) | |
tree | b2cba3207f5b9a1ff7b4789dccdf4b0727a0d40c /gcc | |
parent | 1e326708e83b2e03807c689f14ed3772cd346efc (diff) | |
download | gcc-6fa72945c91260ee27d445fb87f4162032307180.zip gcc-6fa72945c91260ee27d445fb87f4162032307180.tar.gz gcc-6fa72945c91260ee27d445fb87f4162032307180.tar.bz2 |
toplev.c (documented_lang_options): Recognize -include, -imacros, -iwithprefix, -iwithprefixbefore.
* toplev.c (documented_lang_options): Recognize -include,
-imacros, -iwithprefix, -iwithprefixbefore.
* cpplib.c (cpp_start_read): Process -imacros and -include
switches at the same time and in command-line order, after
initializing the dependency-output code. Emit properly nested
#line directives for them. Emit a #line for the main file
before processing these switches, and don't do it again
afterward.
From-SVN: r22689
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cpplib.c | 74 | ||||
-rw-r--r-- | gcc/toplev.c | 6 |
3 files changed, 53 insertions, 38 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be78bfb..20939ca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +Wed Sep 30 19:13:20 1998 Zack Weinberg <zack@rabi.phys.columbia.edu> + + * toplev.c (documented_lang_options): Recognize -include, + -imacros, -iwithprefix, -iwithprefixbefore. + * cpplib.c (cpp_start_read): Process -imacros and -include + switches at the same time and in command-line order, after + initializing the dependency-output code. Emit properly nested + #line directives for them. Emit a #line for the main file + before processing these switches, and don't do it again + afterward. + Wed Sep 30 18:03:22 1998 Richard Henderson <rth@cygnus.com> * function.c (purge_addressof_1): Use bitfield manipulation diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 7521723..c605a4a 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -5972,29 +5972,6 @@ cpp_start_read (pfile, fname) fprintf (stderr, "End of search list.\n"); } - /* Scan the -imacros files before the main input. - Much like #including them, but with no_output set - so that only their macro definitions matter. */ - - opts->no_output++; pfile->no_record_file++; - for (pend = opts->pending; pend; pend = pend->next) - { - if (pend->cmd != NULL && strcmp (pend->cmd, "-imacros") == 0) - { - int fd = open (pend->arg, O_RDONLY, 0666); - if (fd < 0) - { - cpp_perror_with_name (pfile, pend->arg); - return 0; - } - if (!cpp_push_buffer (pfile, NULL, 0)) - return 0; - finclude (pfile, fd, pend->arg, 0, NULL_PTR); - cpp_scan_buffer (pfile); - } - } - opts->no_output--; pfile->no_record_file--; - /* Copy the entire contents of the main input file into the stacked input buffer previously allocated for it. */ if (fname == NULL || *fname == 0) { @@ -6139,24 +6116,48 @@ cpp_start_read (pfile, fname) trigraph_pcp (fp); #endif - /* Scan the -include files before the main input. - We push these in reverse order, so that the first one is handled first. */ + /* Avoid a #line 0 if -include files are present. */ + CPP_BUFFER (pfile)->lineno = 1; + output_line_command (pfile, 0, same_file); + + /* Scan the -include and -imacros files before the main input. */ pfile->no_record_file++; - opts->pending = nreverse_pending (opts->pending); for (pend = opts->pending; pend; pend = pend->next) { - if (pend->cmd != NULL && strcmp (pend->cmd, "-include") == 0) - { - int fd = open (pend->arg, O_RDONLY, 0666); - if (fd < 0) + if (pend->cmd != NULL) + { + if (strcmp (pend->cmd, "-include") == 0) { - cpp_perror_with_name (pfile, pend->arg); - return 0; + int fd = open (pend->arg, O_RDONLY, 0666); + if (fd < 0) + { + cpp_perror_with_name (pfile, pend->arg); + return 0; + } + if (!cpp_push_buffer (pfile, NULL, 0)) + return 0; + if (finclude (pfile, fd, pend->arg, 0, NULL_PTR)) + { + output_line_command (pfile, 0, enter_file); + cpp_scan_buffer (pfile); + } + } + else if (strcmp (pend->cmd, "-imacros") == 0) + { + int fd = open (pend->arg, O_RDONLY, 0666); + if (fd < 0) + { + cpp_perror_with_name (pfile, pend->arg); + return 0; + } + opts->no_output++; + if (!cpp_push_buffer (pfile, NULL, 0)) + return 0; + if (finclude (pfile, fd, pend->arg, 0, NULL_PTR)) + cpp_scan_buffer (pfile); + opts->no_output--; } - if (!cpp_push_buffer (pfile, NULL, 0)) - return 0; - finclude (pfile, fd, pend->arg, 0, NULL_PTR); } } pfile->no_record_file--; @@ -6182,8 +6183,7 @@ cpp_start_read (pfile, fname) pedwarn ("file does not end in newline"); #endif - if (finclude (pfile, f, fname, 0, NULL_PTR)) - output_line_command (pfile, 0, same_file); + finclude (pfile, f, fname, 0, NULL_PTR); return 1; } diff --git a/gcc/toplev.c b/gcc/toplev.c index e575bb4..6ca6b93 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1047,16 +1047,20 @@ documented_lang_options[] = { "-I", "" }, { "-U", "" }, { "-idirafter", "" }, + { "-imacros", "" }, + { "-include", "" }, { "-iprefix", "" }, { "-isystem", "" }, + { "-iwithprefix", "" }, + { "-iwithprefixbefore", "" }, { "-lang-c", "" }, { "-lang-c89", "" }, { "-lang-c++", "" }, + { "-remap", "" }, { "-nostdinc", "" }, { "-nostdinc++", "" }, { "-trigraphs", "" }, { "-undef", "" }, - { "-remap", "" }, #define DEFINE_LANG_NAME(NAME) { NULL, NAME }, |