mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 261967 - Format produces error for __attribute__ ((__unused__)) flag
This commit is contained in:
parent
f0a16ef93a
commit
c0cbc9010d
3 changed files with 10 additions and 2 deletions
|
@ -436,7 +436,6 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
// declarator
|
||||
final IASTDeclarator declarator= node.getDeclarator();
|
||||
if (declarator != null) {
|
||||
skipNonWhitespaceToNode(declarator);
|
||||
boolean needSpace= declarator.getPointerOperators().length > 0 && scribe.printComment();
|
||||
if (needSpace) {
|
||||
scribe.space();
|
||||
|
|
|
@ -1709,9 +1709,12 @@ public class Scribe {
|
|||
fSkippedIndentations--;
|
||||
}
|
||||
} else if (offset > currentPosition) {
|
||||
printComment();
|
||||
boolean hasSpace= printComment();
|
||||
final int nextPosition= scanner.getCurrentPosition();
|
||||
if (offset > nextPosition) {
|
||||
if (hasSpace) {
|
||||
space();
|
||||
}
|
||||
printRaw(nextPosition, offset - nextPosition);
|
||||
scanner.resetTo(offset, scannerEndPosition - 1);
|
||||
}
|
||||
|
|
|
@ -1130,4 +1130,10 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//bool member __attribute__ ((__unused__)) = false;
|
||||
|
||||
//bool member __attribute__ ((__unused__)) = false;
|
||||
public void testPreserveSpaceBetweenNameAnd__attribute__Bug261967() throws Exception {
|
||||
assertFormatterResult();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue