Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uncrustify adds space between double-parenthesis (C/Objective-C)

I'm having a very peculiar issue with uncrustify (v0.60) that no option seems to affect. The issue only occurs when there are parenthesis enclosed within parenthesis:

// from a C header file:
#define BEGIN_STACK_MODIFY(L)  int __index = lua_gettop( (L) );
                                                        ^   ^

// from an ObjC (.m) implementation file:
if ( (self = [super init]) )
    ^                     ^

I want to reformat those to look like this, but uncrustify always adds those spaces between parenthesis (when I manually reformat to the code below, uncrustify will reformat it to the version above, so it's not just being ignored by uncrustify):

// from an ObjC header file:
#define BEGIN_STACK_MODIFY(L)  int __index = lua_gettop((L));

// from an ObjC (.m) implementation file:
if ((self = [super init]))

I used UncrustifyX to check all (well, a great number of) variations of possibly related settings for spaces and parenthesis with no luck.

You can check my uncrustify config file here on gist.

If you have any idea what settings I should try, or perhaps settings that may be in conflict with each other, I'd be happy to test it.

like image 861
LearnCocos2D Avatar asked Oct 22 '22 11:10

LearnCocos2D


1 Answers

(Answering so that this question no longer appears as unanswered on the front page.)

As @Petesh said in the comments: sp_paren_paren is the option you're looking for.

like image 93
Quuxplusone Avatar answered Oct 24 '22 11:10

Quuxplusone