Commit afb03408 by Neil Booth Committed by Neil Booth

cpphash.h (_cpp_read_logical_line_trad, [...]): Update prototypes.

	* 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.

From-SVN: r54446
parent 2754d3c5
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> Mon Jun 10 18:02:24 2002 J"orn Rennecke <joern.rennecke@superh.com>
Fix cfi generation for SH[1-4]: Fix cfi generation for SH[1-4]:
......
...@@ -510,13 +510,14 @@ extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum lc_reason, ...@@ -510,13 +510,14 @@ extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum lc_reason,
extern void _cpp_pop_buffer PARAMS ((cpp_reader *)); extern void _cpp_pop_buffer PARAMS ((cpp_reader *));
/* In cpptrad.c. */ /* 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 *, extern void _cpp_overlay_buffer PARAMS ((cpp_reader *pfile, const uchar *,
size_t)); size_t));
extern cpp_hashnode *_cpp_lex_identifier_trad PARAMS ((cpp_reader *)); extern cpp_hashnode *_cpp_lex_identifier_trad PARAMS ((cpp_reader *));
extern void _cpp_set_trad_context 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_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. */ /* Utility routines and macros. */
#define DSC(str) (const uchar *)str, sizeof str - 1 #define DSC(str) (const uchar *)str, sizeof str - 1
......
...@@ -891,7 +891,7 @@ continue_after_nul (pfile) ...@@ -891,7 +891,7 @@ continue_after_nul (pfile)
buffer->saved_flags = BOL; buffer->saved_flags = BOL;
if (CPP_OPTION (pfile, traditional)) if (CPP_OPTION (pfile, traditional))
more = _cpp_read_logical_line_trad (pfile); more = _cpp_read_logical_line_trad (pfile, true);
else else
{ {
/* Stop parsing arguments with a CPP_EOF. When we finally come /* Stop parsing arguments with a CPP_EOF. When we finally come
......
...@@ -24,6 +24,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -24,6 +24,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "cpplib.h" #include "cpplib.h"
#include "cpphash.h"
#include "intl.h" #include "intl.h"
/* Encapsulates state used to convert the stream of tokens coming from /* Encapsulates state used to convert the stream of tokens coming from
...@@ -42,6 +43,7 @@ static void setup_callbacks PARAMS ((cpp_reader *)); ...@@ -42,6 +43,7 @@ static void setup_callbacks PARAMS ((cpp_reader *));
/* General output routines. */ /* General output routines. */
static void scan_translation_unit PARAMS ((cpp_reader *)); 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 void check_multiline_token PARAMS ((const cpp_string *));
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *)); static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
...@@ -104,6 +106,8 @@ cpp_preprocess_file (pfile) ...@@ -104,6 +106,8 @@ cpp_preprocess_file (pfile)
cpp_scan_nooutput or cpp_get_token next. */ cpp_scan_nooutput or cpp_get_token next. */
if (options->no_output) if (options->no_output)
cpp_scan_nooutput (pfile); cpp_scan_nooutput (pfile);
else if (options->traditional)
scan_translation_unit_trad (pfile);
else else
scan_translation_unit (pfile); scan_translation_unit (pfile);
...@@ -217,6 +221,22 @@ check_multiline_token (str) ...@@ -217,6 +221,22 @@ check_multiline_token (str)
print.line++; 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 /* 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 different line to the current one, output the required newlines or
a line marker, and return 1. Otherwise return 0. */ a line marker, and return 1. Otherwise return 0. */
......
...@@ -298,15 +298,18 @@ restore_buff (pfile) ...@@ -298,15 +298,18 @@ restore_buff (pfile)
/* Reads a logical line into the output buffer. Returns TRUE if there /* Reads a logical line into the output buffer. Returns TRUE if there
is more text left in the buffer. */ is more text left in the buffer. */
bool bool
_cpp_read_logical_line_trad (pfile) _cpp_read_logical_line_trad (pfile, overlay)
cpp_reader *pfile; cpp_reader *pfile;
int overlay;
{ {
cpp_buffer *buffer; cpp_buffer *buffer;
unsigned int first_line; unsigned int first_line = 0;
restore_buff (pfile); if (overlay)
{
first_line = pfile->line = pfile->trad_line; restore_buff (pfile);
first_line = pfile->line = pfile->trad_line;
}
buffer = pfile->buffer; buffer = pfile->buffer;
if (buffer->cur == buffer->rlimit) if (buffer->cur == buffer->rlimit)
...@@ -330,10 +333,14 @@ _cpp_read_logical_line_trad (pfile) ...@@ -330,10 +333,14 @@ _cpp_read_logical_line_trad (pfile)
scan_out_logical_line (pfile, NULL); scan_out_logical_line (pfile, NULL);
buffer->cur = CUR (pfile->context); buffer->cur = CUR (pfile->context);
pfile->trad_line = pfile->line; if (overlay)
pfile->line = first_line; {
_cpp_overlay_buffer (pfile, pfile->trad_out_base, pfile->trad_line = pfile->line;
pfile->trad_out_cur - pfile->trad_out_base); pfile->line = first_line;
_cpp_overlay_buffer (pfile, pfile->trad_out_base,
pfile->trad_out_cur - pfile->trad_out_base);
}
return true; return true;
} }
...@@ -855,7 +862,7 @@ canonicalize_text (dest, src, len, pquote) ...@@ -855,7 +862,7 @@ canonicalize_text (dest, src, len, pquote)
than in the form of their whitespace. */ than in the form of their whitespace. */
bool bool
_cpp_expansions_different_trad (macro1, macro2) _cpp_expansions_different_trad (macro1, macro2)
cpp_macro *macro1, *macro2; const cpp_macro *macro1, *macro2;
{ {
uchar *p1 = xmalloc (macro1->count + macro2->count); uchar *p1 = xmalloc (macro1->count + macro2->count);
uchar *p2 = p1 + macro1->count; uchar *p2 = p1 + macro1->count;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment