diff options
author | Neil Booth <neil@gcc.gnu.org> | 2002-06-11 05:36:17 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-06-11 05:36:17 +0000 |
commit | 1a76916c78c985f1622db1b31d4f05e18c8ae9e4 (patch) | |
tree | d6fe32dd73c2bbc61df005aeef06e301cea3ff11 /gcc/cppmain.c | |
parent | b25bb36a36ac5d73a46f9a910c20ecae5e40dc2f (diff) | |
download | gcc-1a76916c78c985f1622db1b31d4f05e18c8ae9e4.zip gcc-1a76916c78c985f1622db1b31d4f05e18c8ae9e4.tar.gz gcc-1a76916c78c985f1622db1b31d4f05e18c8ae9e4.tar.bz2 |
Makefile.in: Update cppmain.o.
* Makefile.in: Update cppmain.o.
* cpphash.h (struct cpp_reader): Move some members to a
nested structure.
(trad_line): Rename saved_line.
(_cpp_read_logical_line_trad): Update.
(_cpp_remove_overlay): New.
* cppinit.c (cpp_create_reader): No need to set saved_line.
(cpp_destroy): Update.
(cpp_read_main_file): Only overlay if compiling.
* cpplex.c (continue_after_nul): Return false if in directive.
* cpplib.c (EXPAND): New.
(directive_table, SEEN_EOL): Update.
(end_directive): Remove overlay if traditional; don't skip
line in traditional #define.
(prepare_directive_trad): New.
(_cpp_handle_directive, run_directive): Update for traditional
directives.
(lex_macro_node): Simplify, don't use lex_identifier_trad.
* cpplib.h (struct options): Add preprocess_only.
* cppmain.c: Don't include intl.h.
(cpp_preprocess_file): Set options->preprocess_only.
(scan_translation_unit_trad): Fix, and print line numbers.
* cpptrad.c (check_output_buffer, lex_identifier, scan_parameters,
maybe_start_funlike, scan_out_logical_line, replace_args_and_push,
save_replacement_text, _cpp_create_trad_definition): Update for
variable renaming.
(_cpp_overlay_buffer): Save line number.
(_cpp_remove_overlay): Rename from restore_buff, restore line.
(_cpp_read_logical_line_trad): Don't handle overlays here.
(scan_out_logical_line): Process directives.
From-SVN: r54485
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r-- | gcc/cppmain.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c index a5487e7..0edc3d2 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -25,7 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "system.h" #include "cpplib.h" #include "cpphash.h" -#include "intl.h" /* Encapsulates state used to convert the stream of tokens coming from cpp_get_token back into a text file. */ @@ -73,6 +72,10 @@ cpp_preprocess_file (pfile) { options = cpp_get_options (pfile); + /* Let preprocessor know if it's only preprocessing. It would be + nice to lose this somehow. */ + options->preprocess_only = 1; + /* Initialize the printer structure. Setting print.line to -1 here is a trick to guarantee that the first token of the file will cause a linemarker to be output by maybe_print_line. */ @@ -221,20 +224,22 @@ check_multiline_token (str) print.line++; } +/* Writes out a traditionally preprocessed file. */ static void scan_translation_unit_trad (pfile) cpp_reader *pfile; { - bool more; - size_t len; - - do + for (;;) { - more = _cpp_read_logical_line_trad (pfile, false); - len = pfile->trad_out_cur - pfile->trad_out_base; - fwrite (pfile->trad_out_base, 1, len, print.outf); + size_t len; + + if (!_cpp_read_logical_line_trad (pfile)) + break; + len = pfile->out.cur - pfile->out.base; + maybe_print_line (print.map, pfile->out.first_line); + fwrite (pfile->out.base, 1, len, print.outf); + print.printed = 1; } - while (more); } /* If the token read on logical line LINE needs to be output on a |