Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323203

Summary: [formatter] Indentation issue in Code Style for comments
Product: [Tools] CDT Reporter: Leo <alieismy>
Component: cdt-editorAssignee: Project Inbox <cdt-editor-inbox>
Status: RESOLVED INVALID QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, mknauer, yevshif, zeratul976
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
can not format this file
none
CDT log none

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.