Commit graph

12 commits

Author SHA1 Message Date
Gerard Marull-Paretas 407041a10f clang-format: enable SpaceBeforeParens option
The option required clang-format >= 13, we now require >= 15, so it can
be enabled.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-22 15:51:01 +00:00
Keith Short 42f746c8d0 clang-format: Enable InsertBraces option
Zephyr's coding guidelines require braces on every code block body.
Enable InsertBraces option so clang-format automatically adds these
braces.

Signed-off-by: Keith Short <keithshort@google.com>
2022-12-20 22:51:57 +01:00
Rafael Lee e6ef1f3434 clang-format: remove space before colon
To fit the bitfield check in scripts/checkpatch.pl
from: uint8_t : 3;
to:   uint8_t: 3;

Signed-off-by: Rafael Lee <rafaellee.img@gmail.com>
2022-11-16 12:14:58 +00:00
Anas Nashif c417cbc050 clang-format: disable regrouping and sorting of includes
Disable regrouping and sorting of includes which can cause issues due to
order requirements in some subsystems.

Fixes #48520

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-16 11:17:02 +01:00
Johann Fischer dddb5dd6b0 clang-format: do not merge blocks/functions into single line
Align clang-format a bit closer to established coding style
of the project. Similar to commit 51f9f7ca30
("clang-format: do not put enums in single line")'

Never merge blocks/case/functions/if/loops into a single line.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-15 19:18:28 -04:00
Anas Nashif 51f9f7ca30 clang-format: do not put enums in single line
clang-format puts short enums in one single line, making them
unreadable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-01 12:01:05 -04:00
Henrik Brix Andersen 3f0e8dda3d clang-format: restore column limit value of 100
Restore line length limit of 100 characters as introduced in
6432a56ae9.

Fixes: bac0dbe8f2

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-06-27 17:18:04 -04:00
Gerard Marull-Paretas bac0dbe8f2 clang-format: simplify by inheriting from LLVM
The amount of options available on clang-format has become quite
extensive over-time, making a dumped file difficult to read or maintain.
In this patch the .clang-format has been re-written by inheriting from
LLVM (default) since most of the options can be re-used to match the
Zephyr/Linux coding style conventions.

Note: The 14 release has interesting options for Zephyr, in
particular, these new settings would be beneficial:

IfMacros:
  - CHECKIF
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
  AfterForeachMacros: true
  AfterIfMacros: true

.clang-format should be periodically updated as new clang-format
releases reach Linux distros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 09:37:30 -04:00
Gerard Marull-Paretas dbb5e2380d clang-format: update ForEachMacros
Update the list of for each macros using the suggested command in the
configuration file.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-06-15 09:37:30 -04:00
Piotr Pryga 6432a56ae9 clang-format: Change lines length limit from 80 to 100
Change line length limit from former 80 characters to current 100.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 08:13:32 -05:00
Peter Bigot 1ec9d2a9df clang-format: Update with latest FOR_EACH macro list
Correct the shell fragment to use the spelling Zephyr uses, and re-run
it to update the list.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-02 11:23:13 -04:00
Håkon Alseth a88dc36f60 clang-format: add support for clang-format
Add .clang-format style from linux kernel to allow easier
style formatting for developers that do not use uncrustify.
You can call "clang-format -style=file -i my_src.c" within the repo
to in-place fix the style.

Signed-off-by: Håkon Alseth <haal@nordicsemi.no>
2018-11-19 09:31:44 -05:00