Community
Participate
Working Groups
struct Stream { Stream& operator <<(const char*); }; Stream GetStream(); #define MY_MACRO switch (0) case 0: default: GetStream() void test() { MY_MACRO << "Loooooooooooooooooooooooooong string literal" << "another literal."; } Formatting the test function results in: void test() { MY_MACRO<< "Loooooooooooooooooooooooooong string literal" << "another literal."; }
Fixed in cdt_8_0 and master > 20110912.
*** cdt git genie on behalf of Sergey Prigogin *** Bug 357423 - Code formatter gets confused by a macro. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=7065e4648d6f0ac0621540841207da1f1136ce7f
*** cdt git genie on behalf of Sergey Prigogin *** Bug 357423 - Code formatter gets confused by a macro. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=efc55c57d0d12c0f08fefd8a92eab19b30d85675
There is a still a problem if MY_MACRO is defined as: #define MY_MACRO switch (0) case 0: default: if (bool x = false) ; else GetStream()
*** cdt git genie on behalf of Sergey Prigogin *** Bug 357423 - Code formatter gets confused by a macro. Macro involving an 'if' statement. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=a090d9bd2c113591b8c0a734a78d9f051e297c44
*** cdt git genie on behalf of Sergey Prigogin *** Bug 357423 - Code formatter gets confused by a macro. Macro involving an 'if' statement. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=6c90d86c4bdc56ca59ad9b30ab25967fcd618b34
Fixed in master and cdt_8_0.
I have to reopen this bug. There is a regression in the following case: #define EXPR(a) a void f() { switch(EXPR(1)) { default: break; } }
Regression fixed.
*** cdt git genie on behalf of Sergey Prigogin *** Bug 357423. Fixed regression. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=e2aef245cdc7dd73235d035ba5b18ee41496ef1e
*** cdt git genie on behalf of Sergey Prigogin *** Bug 357423. Fixed regression. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=c71e24757865d49999f87bcd49794e27e9327f53
Thanks!