Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324031 - Indentation problems with typedef and enum
Summary: Indentation problems with typedef and enum
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 7.0.1   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 7.0.1   Edit
Assignee: Anton Leherbauer CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-30 16:43 EDT by Henning Riedel CLA
Modified: 2010-09-01 02:23 EDT (History)
1 user (show)

See Also:


Attachments
Code Style Formatter Settings based on BSD-Allman (16.21 KB, text/xml)
2010-08-30 16:43 EDT, Henning Riedel CLA
no flags Details
Fix and tests (3.12 KB, patch)
2010-08-31 04:50 EDT, Anton Leherbauer CLA
aleherb+eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Henning Riedel CLA 2010-08-30 16:43:05 EDT
Created attachment 177784 [details]
Code Style Formatter Settings based on BSD-Allman

Hi folks,

I have here a little annoying thing about indentation. I have CodeStyle set to BSD-Allman

typedef struct
        {
    blah
        };

typedef struct {
    blah
};


That also happens for things like

typedef enum {
    XYZ_ENUM_VALUE1,
   
};

typedef enum         <-- Write typedef enum and hit <ENTER>
        {            <-- Indented automatically, then just wrote '{' and hit <ENTER>
    ENUM_VALUE1      <-- Indented
   
        };

enum {
    XYZ_ENUM_VALUE10 = 0x00,
            XYZ_ENUM_VALUE11      <-- Indented if there is the = 0x00, in the line before
};

Could someone enlighten me, if this is a problem with the attached settings, or are these actually bugs in the indenter?

Regards,
Henning
Comment 1 Anton Leherbauer CLA 2010-08-31 04:50:12 EDT
Created attachment 177817 [details]
Fix and tests

This patch fixes the typedef issue (a regression) and the enum problem which exists also in 6.0.2.
Comment 2 Anton Leherbauer CLA 2010-08-31 04:53:25 EDT
Sergey, could you review my changes before I commit?
Comment 3 Sergey Prigogin CLA 2010-09-01 00:40:08 EDT
LGTM
Comment 4 Anton Leherbauer CLA 2010-09-01 02:07:36 EDT
Thank you! Committed to HEAD and cdt_7_0.