mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 244928 - follow up
This commit is contained in:
parent
78bcda1074
commit
cd8a4b82b0
2 changed files with 56 additions and 0 deletions
|
@ -3090,6 +3090,10 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
}
|
||||
if (!endsWithMacroExpansion) {
|
||||
formatClosingBrace(block_brace_position);
|
||||
} else {
|
||||
if (DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED.equals(block_brace_position)) {
|
||||
scribe.unIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -948,6 +948,58 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//#define BLOCK { }
|
||||
//#define DOIT1() { }
|
||||
//#define DOIT2() do { } while(false)
|
||||
//#define ALWAYS if(true)
|
||||
//#define NEVER if(false)
|
||||
//#define FOREVER for(;;)
|
||||
//
|
||||
//void foo() {
|
||||
// int i=0;
|
||||
// if (true) DOIT1();
|
||||
// if (true) DOIT2();
|
||||
// for (;;) BLOCK
|
||||
// ALWAYS BLOCK
|
||||
// NEVER FOREVER BLOCK
|
||||
// switch(i) {
|
||||
// case 0: BLOCK
|
||||
// }
|
||||
//}
|
||||
|
||||
//#define BLOCK { }
|
||||
//#define DOIT1() { }
|
||||
//#define DOIT2() do { } while(false)
|
||||
//#define ALWAYS if(true)
|
||||
//#define NEVER if(false)
|
||||
//#define FOREVER for(;;)
|
||||
//
|
||||
//void
|
||||
//foo()
|
||||
//{
|
||||
// int i = 0;
|
||||
// if (true)
|
||||
// DOIT1();
|
||||
// if (true)
|
||||
// DOIT2();
|
||||
// for (;;)
|
||||
// BLOCK
|
||||
// ALWAYS
|
||||
// BLOCK
|
||||
// NEVER
|
||||
// FOREVER
|
||||
// BLOCK
|
||||
// switch (i)
|
||||
// {
|
||||
// case 0:
|
||||
// BLOCK
|
||||
// }
|
||||
//}
|
||||
public void testCompoundStatementAsMacroGNU_Bug244928() throws Exception {
|
||||
fOptions= DefaultCodeFormatterOptions.getGNUSettings().getMap();
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//#define A (0)
|
||||
//#define B (1)
|
||||
//#define ARGS (A, B)
|
||||
|
|
Loading…
Add table
Reference in a new issue