Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350816 - [formatter] Fixed size array declaration formats wrong
Summary: [formatter] Fixed size array declaration formats wrong
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 8.0.1   Edit
Assignee: Anton Leherbauer CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-30 08:34 EDT by Michiel Tijhuis CLA
Modified: 2011-08-08 04:23 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michiel Tijhuis CLA 2011-06-30 08:34:14 EDT
Build Identifier: 20110615-0604

After formatting the following array declarations the next statement is placed wrong:

    char szFirstBuffer[BUF_LENGTH + 1];
    char szAffected[13];
    char szUnaffected[13];

Becomes after formatting:

    char szFirstBuffer[BUF_LENGTH + 1];char szAffected[13];
    char szUnaffected[13];

If a single-line comment is placed after the declaration, the formatted output becomes

    char szFirstBuffer[BUF_LENGTH + 1]; // additional char for termination
char    szAffected[13];
    char szUnaffected[13];

If the size of the array is specified as a single token (i.e. [BUF_LENGTH] or [12]) everything the formatting is OK.

I did not notice this behavior in Eclipse 3.6.2 (M20110210-1200) with CDT 7.0.2, earlier versions not tested.



Reproducible: Always

Steps to Reproduce:
1. In a C-source file, declare the following:


    char szFirstBuffer[BUF_LENGTH + 1];
    char szAffected[13];
    char szUnaffected[13];

2. Format them using the code formatter
Comment 1 Anton Leherbauer CLA 2011-08-08 04:11:06 EDT
Fixed in master and 8.0.1.
Comment 2 CDT Genie CLA 2011-08-08 04:23:01 EDT
*** cdt git genie on behalf of Anton Leherbauer ***

    Bug 350816 - [formatter] Fixed size array declaration formats wrong

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=3796041aa8daca55bcc693c3eb9d54fe70c17664
Comment 3 CDT Genie CLA 2011-08-08 04:23:03 EDT
*** cdt git genie on behalf of Anton Leherbauer ***

    Bug 350816 - [formatter] Fixed size array declaration formats wrong

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=0ab89e9c79b3724de8261906ed51a999efd80082