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

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
The warning is effective disabled when #line directives are present, in
should_warn_for_misleading_indentation:

  /* Don't attempt to compare indentation if #line or # 44 "file"-style
     directives are present, suggesting generated code.

     All bets are off if these are present: the file that the #line
     directive could have an entirely different coding layout to C/C++
     (e.g. .md files).

     To determine if a #line is present, in theory we could look for a
     map with reason == LC_RENAME_VERBATIM.  However, if there has
     subsequently been a long line requiring a column number larger than
     that representable by the original LC_RENAME_VERBATIM map, then
     we'll have a map with reason LC_RENAME.
     Rather than attempting to search all of the maps for a
     LC_RENAME_VERBATIM, instead we have libcpp set a flag whenever one
     is seen, and we check for the flag here.
  */
  if (line_table->seen_line_directive)
    return false;

...with another issue being if the .c/.cc file being referred to in the #line
has changed/is available since the linemap/location_t/input.c infrastructure is
set up to handle the referred lines, and not the underlying "physical" lines.

(I have a feeling there's a dup about this somewhere)

Reply via email to