aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.demon.co.uk>2002-06-13 21:16:00 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-06-13 21:16:00 +0000
commitb66377c173ecd444f4fb4f9737ee10a97084ad9a (patch)
tree84d2f1068a69ffbe2208c366f6d8d1f3c43b05d2 /gcc/cppmain.c
parent8bc6e1018593f8525674f79fac6a80d23cb25efb (diff)
downloadgcc-b66377c173ecd444f4fb4f9737ee10a97084ad9a.zip
gcc-b66377c173ecd444f4fb4f9737ee10a97084ad9a.tar.gz
gcc-b66377c173ecd444f4fb4f9737ee10a97084ad9a.tar.bz2
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
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r--gcc/cppmain.c19
1 files changed, 10 insertions, 9 deletions
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);
}
}