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

 
 

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

Submitter:  Daniel P. Valentine <dpv>
Submitted:  Wed 26 Mar 2014 10:05:56 PM UTC
   
 
Category:  C Severity:  3 - Normal
Item Group:  Inconsistency Status:  Fixed
Privacy:  Public Assigned to:  dpv
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 28 Mar 2014 11:30:39 PM UTC, 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>
Group administrator
Wed 26 Mar 2014 10:05:56 PM UTC, 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>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by andrewsh (Updated the item)
  • -email is unavailable- added by dpv (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-06 andrewsh Open/ClosedOpen Closed
    2014-03-28 dpv StatusNone Fixed
        Assigned toNone dpv
    2014-03-27 dpv CategoryNone C
    2014-03-27 dpv Item GroupNone Inconsistency

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code