Community
Participate
Working Groups
If I run the formatter on this code: typedef enum { TRACE_PROTOCOL_T_TRACE_PC = 0x00, TRACE_PROTOCOL_T_RAW_STRING = 0x01, TRACE_PROTOCOL_T_RAW_STRING_TS = 0x02, TRACE_PROTOCOL_T_EFF_STRING = 0x55, TRACE_PROTOCOL_T_EFF_ASSERT = 0x56, TRACE_PROTOCOL_T_EFF_TRACE_EXT = 0xAA, TRACE_PROTOCOL_T_EFF_TRACE_EXT_TS = 0xAB } TRACE_PROTOCOL_T; it will yield: typedef enum { TRACE_PROTOCOL_T_TRACE_PC = 0x00, TRACE_PROTOCOL_T_RAW_STRING = 0x01, TRACE_PROTOCOL_T_RAW_STRING_TS = 0x02, TRACE_PROTOCOL_T_EFF_STRING = 0x55, TRACE_PROTOCOL_T_EFF_ASSERT = 0x56, TRACE_PROTOCOL_T_EFF_TRACE_EXT = 0xAA, TRACE_PROTOCOL_T_EFF_TRACE_EXT_TS = 0xAB } TRACE_PROTOCOL_T; There is currently no way to stop it from removing the alignment. I could imagine having a "preserve white space in type declarations" option in the configuration. An alternative would be to allow detailed control over formatting options, e.g. minimum width for formatted type names.
IMO, elastic tab stops (http://nickgravgaard.com/elastictabstops/, bug 318356) would be a better way of getting this to work than trying to teach the formatter alignment conventions like this.
This bug should be closed (or fixed in CDT 9.7) since it's now possible formatter tags to keep original format on a section of code.
Agreed, the mechanism added in bug 496249 should be good enough for this use case. *** This bug has been marked as a duplicate of bug 496249 ***