-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
Description
clang-format doesn't always seem to format a space between 'identifier (...' when the docs suggest it should:
Here's an input that I have purposefully spaced at odds with clang-format's behaviour -- it is explicitly inserting spaces as expected, or removing them as unexpected.
#define M() 1
#if M () && defined (X) && __has_include ("bob") && __has_cpp_attribute (Y)
#define F(...) __VA_OPT__(__VA_ARGS__)
#endif
void f(){return F(__builtin_LINE () + __builtin_FOO());}
zathras:49> clang-format --style='{BasedOnStyle: LLVM, SpaceBeforeParens: Always}' fmt.cc
#define M() 1
#if M() && defined(X) && __has_include("bob") && __has_cpp_attribute(Y)
#define F(...) __VA_OPT__ (__VA_ARGS__)
#endif
void f () { return F (__builtin_LINE() + __builtin_FOO ()); }
- That
#if
line doesn't insert a space after any of the function-like macro-ish invocations. - The
__VA_OPT__ (
invocation does (as expected) - Known builtin
__builtin_LINE()
has no space, but a random__builtin_FOO ()
does
The same behaviour with BasedOnStyle: GNU
, which of course expects the space in these places.
I'd expect a space in all these cases.
(There is no space in the function-like macro definitions, of course)
vickiegpt