From b66377c173ecd444f4fb4f9737ee10a97084ad9a Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 13 Jun 2002 21:16:00 +0000 Subject: cpphash.h (_cpp_lex_identifier_trad): Remove. * cpphash.h (_cpp_lex_identifier_trad): Remove. * cpplib.c (end_directive): Don't skip, always remove overlay apart from #define. (prepare_directive_trad): Handle NULL pfile->directive. (_cpp_handle_directive): Always call prepare_directive_trad if traditional. * cppmain.c (check_multiline_token): Rename account_for_newlines, generalize inputs. (scan_translation_unit_trad): Use it. * cpptrad.c (skip_comment): Rename copy_comment, copy comment to output, get escaped newline in comment close correct. (check_output_buffer, skip_whitespace): Update. (_cpp_lex_identifier_trad): Remove. (scan_out_logical_line): Handle -C and comments in directives properly. From-SVN: r54599 --- gcc/cppmain.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'gcc/cppmain.c') diff --git a/gcc/cppmain.c b/gcc/cppmain.c index 0edc3d2..7ebc1ad 100644 --- a/gcc/cppmain.c +++ b/gcc/cppmain.c @@ -43,7 +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 void account_for_newlines PARAMS ((const uchar *, size_t)); static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *)); static void print_line PARAMS ((const struct line_map *, unsigned int, @@ -208,19 +208,18 @@ scan_translation_unit (pfile) cpp_output_token (token, print.outf); if (token->type == CPP_COMMENT) - check_multiline_token (&token->val.str); + account_for_newlines (token->val.str.text, token->val.str.len); } } -/* Adjust print.line for newlines embedded in tokens. */ +/* Adjust print.line for newlines embedded in output. */ static void -check_multiline_token (str) - const cpp_string *str; +account_for_newlines (str, len) + const uchar *str; + size_t len; { - unsigned int i; - - for (i = 0; i < str->len; i++) - if (str->text[i] == '\n') + while (len--) + if (*str++ == '\n') print.line++; } @@ -239,6 +238,8 @@ scan_translation_unit_trad (pfile) maybe_print_line (print.map, pfile->out.first_line); fwrite (pfile->out.base, 1, len, print.outf); print.printed = 1; + if (!CPP_OPTION (pfile, discard_comments)) + account_for_newlines (pfile->out.base, len); } } -- cgit v1.1