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 d67880beecb..dc234cb46cd 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 @@ -1338,6 +1338,9 @@ public class CodeFormatterVisitor extends CPPASTVisitor { scribe.space(); } } + if (scribe.printModifiers()) { + scribe.space(); + } node.getName().accept(this); return PROCESS_SKIP; } 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 26812fccad0..a187ff98c21 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 @@ -792,4 +792,17 @@ public class CodeFormatterTest extends BaseUITestCase { public void testNestedTemplatedArgument_Bug241058() throws Exception { assertFormatterResult(); } + + //#define TP_SMALLINT int32_t + //void foo(const TP_SMALLINT &intVal) { } + //void bar(const TP_SMALLINT intVal) { } + + //#define TP_SMALLINT int32_t + //void foo(const TP_SMALLINT &intVal) { + //} + //void bar(const TP_SMALLINT intVal) { + //} + public void testPreserveSpaceInParameterDecl_Bug241967() throws Exception { + assertFormatterResult(); + } }