[cfe-users] Odd namespace formatting with clang-format

Florian Lindner mailinglists at xgm.de
Wed Apr 8 01:22:25 PDT 2015


Florian Lindner wrote:

> Hello,
> 
> I have this piece of code, formatted with clang-format -style llvm:
> <<<
> foo(bar)
> 
>     namespace NS1 {
>   namespace NS2 {}
> 
>>>>
> If I uncomment foo(bar) neither namespace is indented.
> 
> Is the intentionally? Why? If not, is a known bug?

Solution:

foo(bar) is my original code is a macro, not obeying the convention to 
uppercase macros. That's why the missing ; does not fire a syntax error. If 
FOO(bar) is used, clang-format recognizes it as a macro and does not indent 
following lines.

Regards,
Florian




More information about the cfe-users mailing list