https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70270
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|preprocessor |c --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This actually coming from the C/C++ common part of the front-end and not from the preprocessor: void pp_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir) { size_t to_file_len = strlen (dir); unsigned char *to_file_quoted = (unsigned char *) alloca (to_file_len * 4 + 1); unsigned char *p; /* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */ p = cpp_quote_string (to_file_quoted, (const unsigned char *) dir, to_file_len); *p = '\0'; fprintf (print.outf, "# 1 \"%s//\"\n", to_file_quoted); } And when read back in it invokes cb_dir_change: cb->dir_change = cb_dir_change; ... void cb_dir_change (cpp_reader * ARG_UNUSED (pfile), const char *dir) { if (!set_src_pwd (dir)) warning (0, "too late for # directive to set debug directory"); } So I don't think it changes the different line-map behavior at all. The first two lines are special in the preprocessed source for libcpp: /* For preprocessed files, if the very first characters are '#<SPACE>[01]<SPACE>', then handle a line directive so we know the original file name. This will generate file_change callbacks, which the front ends must handle appropriately given their state of initialization. We peek directly into the character buffer, so that we're not confused by otherwise-skipped white space & comments. We can be very picky, because this should have been machine-generated text (by us, no less). This way we do not interfere with the module directive state machine. */ .... /* For preprocessed files, if the tokens following the first filename line is of the form # <line> "/path/name//", handle the directive so we know the original current directory. As with the first line peeking, we can do this without lexing by being picky. */ So I don't think the line mapping changes at all with this.