https://bugs.llvm.org/show_bug.cgi?id=48710
Bug ID: 48710
Summary: Non-deterministic formatting of preprocessor
directives combined with clang-format comments.
Product: clang
Version: 11.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Formatter
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Hello,
The following code:
==================== example.c ====================
void foo(void) {
// clang-format off
#define BAR 42
// clang-format on
}
===================================================
with the following configuration:
================== .clang-format ==================
---
IndentCaseLabels: 'true'
IndentWidth: '4'
...
===================================================
has non-deterministic behavior. When formatted, the line #2 of example.c with
the `// clang-format off` comments looses its indentation, then, when
formatting is performed again on that output, will re-add the indentation,
effectively toggling back-and-forth.
This is a problem because it constantly generates changes in version-control
for the files affected.
I don't know if the problem is more broad than this, but this is how I was able
to reproduce it.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs