+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]:
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
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
#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
/* 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 *));
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);
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. */
/* 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)
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;
}
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;