| Summary: | Code formatter fails when structure has attribute before the opening brace | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Eugene Ostroukhov <eostroukhov> |
| Component: | cdt-editor | Assignee: | Project Inbox <cdt-editor-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Anton Leherbauer <aleherb+eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, yevshif, zeratul976 |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I can't reproduce the exception.
The resut of the formatting may be a bit strange:
typedef struct
__attribute__((aligned(8)))
{
unsigned int l, a;
} LA32;
but I believe that's covered by bug 467346.
|
Following declaration causes code formatter to fail with an exception: typedef struct __attribute__((aligned(8))) { unsigned int l, a; } LA32; Exception stack trace: org.eclipse.cdt.internal.formatter.AbortFormatting: [22/1] Unexpected token type, expecting:12, actual:Token type=1 image =__attribute__ offset=895 at org.eclipse.cdt.internal.formatter.Scribe.printNextToken(Scribe.java:1623) at org.eclipse.cdt.internal.formatter.CodeFormatterVisitor.formatOpeningBrace(CodeFormatterVisitor.java:3984) at org.eclipse.cdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:1872) at org.eclipse.cdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:851) at org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTCompositeTypeSpecifier.accept(CPPASTCompositeTypeSpecifier.java:155) ... Attached to the bug is a lazy formatter fix - it will simply skip everything until the opening brace is found.