New coding style for new files?

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 11 07:41:13 UTC 2020


On 10/09/2020 17:32, Joel Sherrill wrote:

>
>
> On Thu, Sep 10, 2020 at 10:24 AM Gedare Bloom <gedare at rtems.org 
> <mailto:gedare at rtems.org>> wrote:
>
>     On Mon, Sep 7, 2020 at 12:06 AM Sebastian Huber
>     <sebastian.huber at embedded-brains.de
>     <mailto:sebastian.huber at embedded-brains.de>> wrote:
>     >
>     > Hello,
>     >
>     > I think we waste too much time to address coding style issues on
>     newly
>     > contributed code, for example GSoC. I don't know a source code
>     > formatting tool which supports the RTEMS coding style and I
>     think it is
>     > not worth the time to write and maintain such a tool
>     specifically for
>     > RTEMS. Why don't we simply allow an alternative coding style
>     which has a
>     > good code formatter for new source files? I don't propose to
>     reformat
>     > the existing files.
>     >
>     > I would simply pick up one of the standard styles supported by
>     > clang-format and declare it as an acceptable coding style for RTEMS.
>
>
> I am not willing to blanket accept another project's coding style.
>
> I am willing to accept a configuration for a tool that is close to our 
> style and
> make compromises on specific points.

We had a student to figure this out for clang-format some time ago:

https://lists.rtems.org/pipermail/devel/2019-February/024912.html

We could also have a look at uncrustify:

https://github.com/uncrustify/uncrustify

It seems to be still actively maintained on Github.

>
> I also think when doing this we should consider things that we do that
> we have since learned safety standards don't like such as single statement
> if's without braces. I think we should have braces now.
I think uncrustify had options to do this. I am not sure if clang-format 
can do this.
>
> This is best viewed as an opportunity to improve but comes with changes
> since I don't think any of us wants to add a few more configuration 
> options
> to any formatter. Although if we get close, I can see adding those as open
> projects if someone is interested.
Good, I think we should have a look at uncrustify. The RTEMS coding 
style is too exotic for clang-format.


More information about the devel mailing list