Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Code breaking reformat for simdjson.h #45902

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR46933
Status NEW
Importance P enhancement
Reported by Šimon Tóth (happy.cerberus@gmail.com)
Reported on 2020-07-31 07:03:52 -0700
Last modified on 2020-07-31 08:28:02 -0700
Version 10.0
Hardware PC Windows NT
CC djasper@google.com, Jake.Merdich@amd.com, klimek@google.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Code breaking reformat. The warning disabling macros are broken when processed
with this style (spaces inserted in places where they shouldn't).

Example after reformat:
SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft - include)

Processing this file:
https://github.com/simdjson/simdjson/blob/master/singleheader/simdjson.h

With this style:
BasedOnStyle: Google
---
Language: Cpp
AlignOperands: true
AlignAfterOpenBracket: AlwaysBreak
AllowAllParametersOfDeclarationOnNextLine: true
BinPackParameters: false
BinPackArguments: false
DerivePointerAlignment: false
PointerAlignment: Left
ColumnLimit: 100
Quuxplusone commented 4 years ago
I'm not aware of any other place in cpp where whitespace matters for the '-'
sign. Also, clang-format has *really* limited context information inside of
macros, especially ones that evaluate to compiler-specific pragmas. That means
we can't detect this automatically.

Good news is that we recently added a flag for a similar case that fits this
perfectly. Try WhitespaceSensitiveMacros: ['SIMDJSON_DISABLE_GCC_WARNING'].

This will be available in the final release of clang-format 11 (already
available on linux prerelease packages but not in windows snapshots).