https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

--- Comment #9 from David Rivshin <drivshin at allworx dot com> ---
I think the extra newline is the result of maybe_print_line() being invoked
when trying to peek past a newline in the input.

#0  maybe_print_line_1 (src_loc=134, stream=0x361e3b8800 <_IO_2_1_stdout_>) at
c-ppoutput.c:352
#1  maybe_print_line (src_loc=134) at c-ppoutput.c:385
#2  do_line_change (pfile=0x1ef2910, token=0x1f1dd68, src_loc=134,
parsing_args=0) at c-ppoutput.c:463
#3  cb_line_change (pfile=0x1ef2910, token=0x1f1dd68, parsing_args=0) at
c-ppoutput.c:490
#4  _cpp_lex_token (pfile=0x1ef2910) at lex.c:2192
#5  cpp_peek_token (pfile=0x1ef2910, index=0) at lex.c:2085
#6  cpp_get_token_1 (pfile=0x1ef2910, location=0x7fffffffd8fc) at macro.c:2501

If I'm understanding the logic correctly, when _cpp_lex_direct() sees the
newline, the processing of the line is considered complete, and therefore that
line of output complete. But because of the conditional macro that's not
entirely true, and the output only has the line up to (but not including) the
conditional macro token itself at that point.

Reply via email to