https://bugs.llvm.org/show_bug.cgi?id=44324

            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: unassignedclangb...@nondot.org
          Reporter: simon.mar...@polymtl.ca
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to