<div dir="ltr"><div>Hello,</div><div><br></div><div>we are trying to describe the rtems formatting style using clang-format (<a href="http://clang.llvm.org/docs/ClangFormatStyleOptions.html" target="_blank">http://clang.llvm.org/docs/ClangFormatStyleOptions.html</a>).</div><div>To
see whether it can be done, we used ratemonperiod.c as an example and
tried to set up a .clang-format file to describe the formatting.<br></div><div>In the mail added the .clang configuration file and a ratemonperiodWKCustom_Commented.c, which is ratemonperiod.c with the configuration in .clang-format applied.<br></div><div><br></div><div>With the .clang-format file in the folder with the source files, it can be tried out with: <br></div><div>clang-format -style=file original_source.c > formatted_source.c</div><div><br></div><div>There are several problems in ratemonperiodWKCustom_Commented.c using clang-format:<br></div><br><div>1.
In line 30-32, we can see that the "*" of the pointers are not aligned
to the right. This is not supported yet it clang-format (see <a href="https://stackoverflow.com/questions/38392889/clang-format-align-asterisk-of-pointer-declaration-with-variable-name" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/38392889/clang-format-align-asterisk-of-pointer-declaration-with-variable-name</a>).</div><div><br></div><div>2.
In line 32, the ")" at the end of the parameter list needs to be in a
new row, but this doesn't seem to be supported in clang-format. <br></div><div><br></div><div>4. In line 44: If the function call is split into multiple rows, the ");" should always be in a new row.<br></div><div><br></div><div>5.
Also in line 44, when a function call is split into multiple rows. The
parameters can all be in separate rows, but clang-format always puts all
the parameters in one row when they fit.</div><div><br></div><div>6. In
line 80, clang-format does not stick to the column limit of 80. The
line is 81 long. I have tried to configure a strict 80 column rule with
the penalties, but there are still lines with 81 characters.<br></div><div><br></div><div>7.
In line 127, I can't turn off the break after the function return type
in this case. <br></div><div><br></div><div>8. In line 127, the
parameter is not in a new line, but in rtems we would need every
parameter of a function definition to always be in seperate line. Line 182, 279 have the same problem.<br></div><div><br></div><div>8.
Lines 323, 330, 335, 348: It should be possible to specify that the
functions arguments can be in seperate rows.</div><div><br></div><div>We have also asked the clang community how much effort it would take to implement these points.</div><div><br></div><div>Best,</div><div>Mikail</div></div>