Reputation: 23
I am using TrueSTUDIO 9.1.0 and also tested this within fresh Eclipse IDE for C/C++ developers version: 2018-09 (4.9.0).
Automatic code formatter seems to be putting semicolon after a macro call on a new line.
Steps to reproduce:
Download Eclipse IDE for C/C++ developers version: 2018-09 (4.9.0) for Windows 32bit.
Create new empty C project
Create .c file with code:
#define testmacro() do {printf("test");} while (0)
void main(void) {
testmacro();
}
Format the whole file by pressing Ctrl+Shift+F
Get:
#define testmacro() do {printf("test");} while (0)
void main(void) {
testmacro()
;
}
It was discussed and dismissed in this question (link) for the reason that it was fixed.
Am I doing something wrong or did the error come back?
Upvotes: 2
Views: 741
Reputation: 52799
I don't think you're doing anything wrong, the CDT built-in formatter is just buggy and unmaintained. There are dozens of open bugs about its behaviour. In this case, it looks like bug 475349.
I would recommend using a plugin that wraps a modern, maintained formatter like clang-format
, such as CppStyle.
Upvotes: 2