Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323203 - [formatter] Indentation issue in Code Style for comments
Summary: [formatter] Indentation issue in Code Style for comments
Status: RESOLVED INVALID
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-19 22:19 EDT by Leo CLA
Modified: 2017-01-02 19:54 EST (History)
4 users (show)

See Also:


Attachments
can not format this file (51.39 KB, application/octet-stream)
2010-08-23 14:14 EDT, Leo CLA
no flags Details
CDT log (708.12 KB, application/octet-stream)
2010-08-25 09:29 EDT, Leo CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leo CLA 2010-08-19 22:19:04 EDT
Before the codes as follows:
...
//---------------------------------------------------
// Method Name: collectOptData
// Description: triggers collection of Optical PM data
//---------------------------------------------------

void Ot11dpe12ePmDataCollector::collectOptData() 
{
...
}

//---------------------------------------------------
// Method Name: getOptData
// Description: gets Optical PM data
//---------------------------------------------------

int Ot11dpe12ePmDataCollector::getOpticalPwr(int direction, int &pwrval) 
{
    LTRACE(TRCENTRY | TRCLVL3, "Ot11dpe12ePmDataCollector::collectOptData\n");
    float op;
    // Retrive Power for Line or Client Port
    if ((portNum >= e11DPE12E_NetworkPort1Num)) 
    {
        ...
    }
}
...

When use BSD/Allman profile Code Style/formatting do format(ctrl+shift+F), the codes changed as follows:

...
    //---------------------------------------------------
    // Method Name: collectOptData
    // Description: triggers collection of Optical PM data
    //---------------------------------------------------

void Ot11dpe12ePmDataCollector::collectOptData() 
{
...
}

    //---------------------------------------------------
    // Method Name: getOptData
    // Description: gets Optical PM data
    //---------------------------------------------------

int Ot11dpe12ePmDataCollector::getOpticalPwr(int direction, int &pwrval) 
{
    LTRACE(TRCENTRY | TRCLVL3, "Ot11dpe12ePmDataCollector::collectOptData\n");
    float op;
    // Retrive Power for Line or Client Port
            if ((portNum >= e11DPE12E_NetworkPort1Num)) 
            {
             ...
            }
    }
...

The head "//" comments of method will indent 4 space, and "//"comments in method will indent 8 space, this was very strange.

The GNU, K&R and Whitesmits profile was same as BSD/Allman for this case.
Comment 1 Anton Leherbauer CLA 2010-08-20 05:22:07 EDT
I cannot reproduce with the given example.  I suspect some parsing error and/or exception during formatting.  Please attach the error log of your workspace after an attempt to format.  Also, please try to create a reproducible example.  Thanks.
Comment 2 Leo CLA 2010-08-23 14:14:55 EDT
Created attachment 177246 [details]
can not format this file

This file can not format some comments use BSD/Allman profile Code Style/formatting.
Comment 3 Anton Leherbauer CLA 2010-08-24 04:34:08 EDT
Works for me.
Please attach the error log file (<workspace>/.metadata/.log).
Comment 4 Leo CLA 2010-08-25 09:29:45 EDT
Created attachment 177416 [details]
CDT log

Log for format issue of CDT.
Comment 5 Anton Leherbauer CLA 2010-08-31 03:00:48 EDT
This is another instance where the formatter gets confused by some macros.
It would help if you could create a minimal test case which reproduces the issue.
Comment 6 Nathan Ridge CLA 2017-01-02 19:54:42 EST
Closing as no complete testcase has been provided. Feel free to reopen if you provide a complete testcase.