bugGNU indent - Bugs: bug #54673, --space-after-if not honored when...

 
 

bug #54673: --space-after-if not honored when using function pointer parameter and --no-space-after-function-call-names

Submitter:  Chris Merck <chrismerck>
Submitted:  Mon 17 Sep 2018 03:51:25 PM UTC
   
 
Category:  C Severity:  3 - Normal
Item Group:  Incorrect Result Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 17 Sep 2018 03:51:25 PM UTC, original submission:  

Version: GNU indent 2.2.12

Input:

void
f(void (x)(void ))
{
  if (!x)
    return;
}

void
g(void *x)
{
  if (!x)
    return;
}

Command line:

indent --no-space-after-function-call-names  --space-after-if

Unexpected Result:

In the function f(), the space after if is removed.

I believe indent believes that the if is a function call.

The problem does not occur for function g, where there is no function pointer parameter.

Workaround:

Add a dummy statement,   x = x;  , prior to the conditional as a shield.

Chris Merck <chrismerck>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #45029:  x.c.old added by chrismerck (104B - application/octet-stream - Uploading example as file, due to formatting removed from code in original comment.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chrismerck (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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-09-17 chrismerck Attached File- Added x.c.old, #45029

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code