SYS_SEM_LOCK() is a for-loop-like macro similar inspired by
K_SPINLOCK().
Add an entry to .clang-format so that autoformatting works as
expected.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Add i3c_bus_for_each_i3cdev and i3c_bus_for_each_i2cdev to more easily
iterate through each i3c or i2c device on the bus.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
An issue with some macros is that a space is added to conditional
expansions. Prevent some of these macros to get formatted.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
add missing FOREACH macros to stop clang-format from moving the opening
curly brace into a new line.
Signed-off-by: Gerhard Jörges <joerges@metratec.com>
The ARRAY_FOR_EACH() and ARRAY_FOR_EACH_PTR() macros were not
formatting correctly in vs code (and I would guess other
editors).
Add an entry to .clang-format so that the opening brace is on
the same line as the macro.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
SYS_SEM_LOCK() is a for-loop-like macro similar inspired by
K_SPINLOCK().
Add an entry to .clang-format so that autoformatting works as
expected.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The K_SPINLOCK is been indented wrongly by clang-format. It fixes that
adding the K_SPINLOCK to the FOR_EACH section rule tells the formatter
to follow the rule to indent the code.
Signed-off-by: Rodrigo Peixoto <rodrigopex@gmail.com>
Modify UseTab to use ForContinuationAndIndentation instead
of always. This will only use tabs for indentation, and then
spaces for alignment, which is the most commonly used approach
in Zephyr.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Sometimes we want to force the inlining of a __syscall. Introduce a new
__syscall_always_inline symbol to do that.
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
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>
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>
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>
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>
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>
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>