summaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-13 21:16:00 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-13 21:16:00 +0000
commitc455fac3b6e5ac4e62cc45153d926de62d98d9f7 (patch)
tree84d2f1068a69ffbe2208c366f6d8d1f3c43b05d2 /gcc/cppmain.c
parent493914a8e47faf38cc3fa8da31a083869318a297 (diff)
downloadgcc-c455fac3b6e5ac4e62cc45153d926de62d98d9f7.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54599 138bc75d-0d04-0410-961f-82ee72b054a4
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 0edc3d2b25b..7ebc1ad2c5a 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);
}
}