From dbe4fed550e75561a1749b5973a8a5f7dcbbd2cd Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 5 Aug 2011 14:19:14 +0200 Subject: [PATCH] Bug 344379 - Code Style format error --- .../formatter/CodeFormatterVisitor.java | 2 +- .../cdt/ui/tests/text/CodeFormatterTest.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index 132590cf1c8..fb44a2b7fc2 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -2600,7 +2600,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, return formatOverloadedLeftShiftChain(node); } - Runnable tailFormatter = scribe.takeTailFormatter(); + Runnable tailFormatter = endsWithMacroExpansion(node) ? null : scribe.takeTailFormatter(); Alignment expressionAlignment= scribe.createAlignment( Alignment.BINARY_EXPRESSION, diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index 7fafcd2d54a..e7891ec5f80 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -2494,4 +2494,22 @@ public class CodeFormatterTest extends BaseUITestCase { assertFormatterResult(); } + //#define A 1 + //#define B 2 + //#define C 4 + //void f(int x, int y) { + // f(A|B|C,5); + // return; + //} + + //#define A 1 + //#define B 2 + //#define C 4 + //void f(int x, int y) { + // f(A | B | C, 5); + // return; + //} + public void testMacroInBinaryExpression_Bug344379() throws Exception { + assertFormatterResult(); + } }