gedare wrote:

> > The code is [self-hosted](https://git.rtems.org/rtems/) and [mirrored on 
> > GitHub](https://github.com/RTEMS/rtems) with a [documented style 
> > guide](https://docs.rtems.org/branches/master/eng/coding-formatting.html). 
> > In addition, I have been and will continue to be willing to provide bug fix 
> > and other maintenance support to clang-format based on the changes 
> > submitted to support these style needs.
> > At the moment, I need to satisfy a particular style rule that requires me 
> > to add spaces inside of conditional and compound expressions.
> 
> It seems the RTEMS style guide you linked above doesn't have any examples for 
> conditional expressions and compound expressions, and by _conditional 
> expressions_ I assume it means conditionals of control statements rather than 
> ternary [conditional 
> expressions](https://www.ibm.com/docs/en/zos/3.1.0?topic=operators-conditional-expressions).
> 
Correct. Unfortunately, no one (myself) has not taken the time to thoroughly 
document all examples. The existing style has been inherited from the original 
author of our code base, as these things tend to be for older projects.

> 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__( _alignment ) ))`




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