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 19ba1afcff7..c4da1712865 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 @@ -3885,20 +3885,22 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, if (currentOffset > nodeEndOffset) { return; } - IASTNodeLocation[] locations= node.getNodeLocations(); - for (int i= 0; i < locations.length; i++) { - IASTNodeLocation nodeLocation= locations[i]; - if (nodeLocation instanceof IASTMacroExpansionLocation) { - IASTFileLocation expansionLocation= nodeLocation.asFileLocation(); - int startOffset= expansionLocation.getNodeOffset(); - int endOffset= startOffset + expansionLocation.getNodeLength(); - if (currentOffset <= startOffset) { - break; - } - if (currentOffset < endOffset || - currentOffset == endOffset && i == locations.length - 1) { - scribe.skipRange(startOffset, endOffset); - break; + if (!fInsideMacroArguments) { + IASTNodeLocation[] locations= node.getNodeLocations(); + for (int i= 0; i < locations.length; i++) { + IASTNodeLocation nodeLocation= locations[i]; + if (nodeLocation instanceof IASTMacroExpansionLocation) { + IASTFileLocation expansionLocation= nodeLocation.asFileLocation(); + int startOffset= expansionLocation.getNodeOffset(); + int endOffset= startOffset + expansionLocation.getNodeLength(); + if (currentOffset <= startOffset) { + break; + } + if (currentOffset < endOffset || + currentOffset == endOffset && i == locations.length - 1) { + scribe.skipRange(startOffset, endOffset); + break; + } } } }