https://bugs.llvm.org/show_bug.cgi?id=38953
Bug ID: 38953
Summary: clang-format breaks code by inserting spaces inside
macro calls
Product: clang
Version: 7.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Formatter
Assignee: unassignedclangb...@nondot.org
Reporter: ignat.losku...@gmail.com
CC: djas...@google.com, kli...@google.com,
llvm-bugs@lists.llvm.org
$ cat test.c
#include <stdio.h>
#define AS_STRING(x) #x
int main() {
puts(AS_STRING(string-with-minus));
}
$ gcc test.c && ./a.out
string-with-minus
$ clang-format-7 -i test.c && gcc test.c && ./a.out
string - with - minus
$ cat test.c
#include <stdio.h>
#define AS_STRING(x) #x
int main() { puts(AS_STRING(string - with - minus)); }
$ lsb_release -d
Description: Ubuntu 18.04.1 LTS
$ dpkg-query --showformat='${Version}\n' --show clang-format-7
1:7~svn323616-1
The code changed its behavior after formatting because some whitespace was
added inside a macro call.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs