1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 00:36:16 +02:00

Bug 550096 - Fix format function parameters in macro expansion

Change-Id: I509e434032a49a853e1794ab2d4b5a6a864eb5da
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
Marco Stornelli 2019-10-13 10:14:28 +02:00
parent f8316e315b
commit 5c77776dcd
2 changed files with 13 additions and 2 deletions

View file

@ -2483,8 +2483,10 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
*/
private void formatList(List<?> elements, ListOptions options, boolean encloseInParen, boolean addEllipsis,
Runnable tailFormatter, Runnable prefix) {
if (encloseInParen)
scribe.printNextToken(options.leftToken, options.fSpaceBeforeOpeningParen);
if (encloseInParen) {
if (peekNextToken() == options.leftToken)
scribe.printNextToken(options.leftToken, options.fSpaceBeforeOpeningParen);
}
final int elementsLength = elements.size();
if (encloseInParen) {

View file

@ -4699,4 +4699,13 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testStructuredBindingInSwitchInitStatement() throws Exception {
assertFormatterResult();
}
//#define PROTO(X) X
//void foo PROTO((char* b));
//#define PROTO(X) X
//void foo PROTO((char* b));
public void testMacroInFunctionParameters_Bug550096() throws Exception {
assertFormatterResult();
}
}