diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cpphash.h | 5 | ||||
-rw-r--r-- | gcc/cpplex.c | 2 | ||||
-rw-r--r-- | gcc/cppmain.c | 20 | ||||
-rw-r--r-- | gcc/cpptrad.c | 27 |
5 files changed, 53 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dac47a6..4409487 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2002-06-10 Neil Booth <neil@daikokuya.demon.co.uk> + + * cpphash.h (_cpp_read_logical_line_trad, + _cpp_expansions_different_trad): Update prototypes. + * cpplex.c (continue_after_nul): New. + * cppmain.c: Include cpphash.h. + (scan_translation_unit_trad): New. + (cpp_preprocess_file): Call it. + * cpptrad.c (_cpp_read_logical_line_trad): Take new parameter + overlay. + (_cpp_expansions_different_trad): Update prototype. + Mon Jun 10 18:02:24 2002 J"orn Rennecke <joern.rennecke@superh.com> Fix cfi generation for SH[1-4]: diff --git a/gcc/cpphash.h b/gcc/cpphash.h index 6d41ead..0fa3e13 100644 --- a/gcc/cpphash.h +++ b/gcc/cpphash.h @@ -510,13 +510,14 @@ extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum lc_reason, extern void _cpp_pop_buffer PARAMS ((cpp_reader *)); /* In cpptrad.c. */ -extern bool _cpp_read_logical_line_trad PARAMS ((cpp_reader *)); +extern bool _cpp_read_logical_line_trad PARAMS ((cpp_reader *, int)); extern void _cpp_overlay_buffer PARAMS ((cpp_reader *pfile, const uchar *, size_t)); extern cpp_hashnode *_cpp_lex_identifier_trad PARAMS ((cpp_reader *)); extern void _cpp_set_trad_context PARAMS ((cpp_reader *)); extern bool _cpp_create_trad_definition PARAMS ((cpp_reader *, cpp_macro *)); -extern bool _cpp_expansions_different_trad PARAMS ((cpp_macro *, cpp_macro *)); +extern bool _cpp_expansions_different_trad PARAMS ((const cpp_macro *, + const cpp_macro *)); /* Utility routines and macros. */ #define DSC(str) (const uchar *)str, sizeof str - 1 diff --git a/gcc/cpplex.c b/gcc/cpplex.c index 0dd9d22..66eb01f 100644 --- a/gcc/cpplex.c +++ b/gcc/cpplex.c @@ -891,7 +891,7 @@ continue_after_nul (pfile) buffer->saved_flags = BOL; if (CPP_OPTION (pfile, traditional)) - more = _cpp_read_logical_line_trad (pfile); + more = _cpp_read_logical_line_trad (pfile, true); else { /* Stop parsing arguments with a CPP_EOF. When we finally come diff --git a/gcc/cppmain.c b/gcc/cppmain.c index b04e86f..a5487e7 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -24,6 +24,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" #include "cpplib.h" +#include "cpphash.h" #include "intl.h" /* Encapsulates state used to convert the stream of tokens coming from @@ -42,6 +43,7 @@ static void setup_callbacks PARAMS ((cpp_reader *)); /* General output routines. */ static void scan_translation_unit PARAMS ((cpp_reader *)); +static void scan_translation_unit_trad PARAMS ((cpp_reader *)); static void check_multiline_token PARAMS ((const cpp_string *)); static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *)); @@ -104,6 +106,8 @@ cpp_preprocess_file (pfile) cpp_scan_nooutput or cpp_get_token next. */ if (options->no_output) cpp_scan_nooutput (pfile); + else if (options->traditional) + scan_translation_unit_trad (pfile); else scan_translation_unit (pfile); @@ -217,6 +221,22 @@ check_multiline_token (str) print.line++; } +static void +scan_translation_unit_trad (pfile) + cpp_reader *pfile; +{ + bool more; + size_t len; + + do + { + 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); + } + while (more); +} + /* If the token read on logical line LINE needs to be output on a different line to the current one, output the required newlines or a line marker, and return 1. Otherwise return 0. */ diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index 4a76f96..18d5adb 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -298,15 +298,18 @@ restore_buff (pfile) /* Reads a logical line into the output buffer. Returns TRUE if there is more text left in the buffer. */ bool -_cpp_read_logical_line_trad (pfile) +_cpp_read_logical_line_trad (pfile, overlay) cpp_reader *pfile; + int overlay; { cpp_buffer *buffer; - unsigned int first_line; + unsigned int first_line = 0; - restore_buff (pfile); - - first_line = pfile->line = pfile->trad_line; + if (overlay) + { + restore_buff (pfile); + first_line = pfile->line = pfile->trad_line; + } buffer = pfile->buffer; if (buffer->cur == buffer->rlimit) @@ -330,10 +333,14 @@ _cpp_read_logical_line_trad (pfile) scan_out_logical_line (pfile, NULL); buffer->cur = CUR (pfile->context); - pfile->trad_line = pfile->line; - pfile->line = first_line; - _cpp_overlay_buffer (pfile, pfile->trad_out_base, - pfile->trad_out_cur - pfile->trad_out_base); + if (overlay) + { + pfile->trad_line = pfile->line; + pfile->line = first_line; + _cpp_overlay_buffer (pfile, pfile->trad_out_base, + pfile->trad_out_cur - pfile->trad_out_base); + } + return true; } @@ -855,7 +862,7 @@ canonicalize_text (dest, src, len, pquote) than in the form of their whitespace. */ bool _cpp_expansions_different_trad (macro1, macro2) - cpp_macro *macro1, *macro2; + const cpp_macro *macro1, *macro2; { uchar *p1 = xmalloc (macro1->count + macro2->count); uchar *p2 = p1 + macro1->count; |