gedare wrote:

> > > Would `__attribute__((noreturn))`, `if ((i = j))`, `decltype((x))`, and 
> > > `while (((i + 1) * j - 2) * k > 3)` be formatted as `__attribute__(( 
> > > noreturn ))`, `if (( i = j ))`, `decltype(( x ))`, and `while ( ( ( i + 1 
> > > ) * j - 2 ) * k > 3 )`, respectively?
> > 
> > 
> > Almost, it would also be `if ( ( i = j ) )`, Although repeated parens are 
> > typically removed. So a better example is `if ( ( i = j ) && ( k > 3 ) )`
> > We don't have `decltype` in our C code base. I can add support for it as an 
> > option if desired.
> > We also have cases such as `__attribute__(( __aligned__( x ) ))`
> 
> I'm ok with all of the above except for `if ( ( i = j ) )`, which should be 
> formatted as `if (( i = j ))` because the extra pair of parentheses is not 
> superfluous. This is similar to `decltype(( x ))`, and the`RemoveParentheses` 
> option doesn't strip the extra pair for either.
> 
Yes, good point.

> It seems adding a boolean sub-option that targets double pairs of parentheses 
> as I suggested before is feasible although a better name than 
> `ConsecutiveParentheses` may be needed.

I'm fine to fix but request a concrete suggestion or proposal before I spend 
much more time on this. It might also work to suppress optionally the 
additional space on the first/last parenthesis pair, for these special "paired" 
parens. I think the way I already worked this patch is the right way to go to 
preserve backward compatibility while still allowing control over the repeated 
parentheses. 

Looks like it is called `MultipleParentheses` in the `RemoveParentheses` 
option. I should rename to that.

https://github.com/llvm/llvm-project/pull/77522
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to