[llvm-bugs] [Bug 44324] New: Difference with gcc's -Wmisleading-indentation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 17 11:53:06 PST 2019


            Bug ID: 44324
           Summary: Difference with gcc's -Wmisleading-indentation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: simon.marchi at polymtl.ca
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

clang++ 10 reports a misleading indentation warning with the attached code,
whereas g++ does not.

test.cpp:14:7: warning: misleading indentation; statement is not part of the
previous 'if' [-Wmisleading-indentation]
      j = j;
test.cpp:11:4: note: previous statement is here
          if (k)
1 warning generated.

The warning is due to the presence of a spurious space at the beginning of line
12, before the tab.  I don't really know if this should warn or not (or if
there's even a right answer to this), but I thought I would report it so you
can judge for yourself.

I've been told [1]that gcc respects tab stops to compute the indentation.  My
understanding is that for gcc, "<space><tab>" and "<tab>" will both amount to 8
columns (using the default of -ftabstop=8), so it won't make a difference.

[1] https://sourceware.org/ml/gdb-patches/2019-12/msg00751.html

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191217/b2942531/attachment.html>

More information about the llvm-bugs mailing list