bugGNU indent - Bugs: bug #41966, -ce option moves comment after if{}

 
 

bug #41966: -ce option moves comment after if{}

Submitted by:  Daniel P. Valentine <dpv>
Submitted on:  Wed Mar 26 22:05:56 2014  
 
Category: CSeverity: 3 - Normal
Item Group: InconsistencyStatus: Fixed
Privacy: PublicAssigned to: Daniel P. Valentine <dpv>
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri Mar 28 23:30:39 2014, comment #1:

Corrected this and a couple of related inconsistencies. It is in the code repository (with new regression tests) and should be included in the next release.

Daniel P. Valentine <dpv>
Project AdministratorIn charge of this item.
Wed Mar 26 22:05:56 2014, original submission:

the -ce causes comment following closing if brace to move to next line
From: Phil Smith
Subject: the -ce causes comment following closing if brace to move to next line
Date: Fri, 9 Aug 2013 19:50:49 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

With this example:

int aa(int b)
{
int a = 1;;
if (a == 1) {
a = 2;
} /* if (a == 1 ... */
/* call check a */
if (!check(a)) {
a = 0;
}
}

Running this command:

/bin/indent -br -ce -st aa.c

The output is this:

int
aa (int b)
{
int a = 1;;
if (a == 1) {
a = 2;
}
/* if (a == 1 ... */
/* call check a */
if (!check (a)) {
a = 0;
}
}

However I wouldn't expect the -ce to cause the
/* if (a == 1 ... */
comment to move onto the next line.
Without the -ce this doesn't happen.

Daniel P. Valentine <dpv>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dpv (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Mar 28 23:30:39 2014dpvStatusNone=>Fixed
      Assigned toNone=>dpv
    Thu Mar 27 22:34:47 2014dpvCategoryNone=>C
    Thu Mar 27 22:34:20 2014dpvItem GroupNone=>Inconsistency

    Back to the top


    Powered by Savane 3.1-cleanup