From de90dfccbcb9c305a13a7ed1dcd77df2d1c16785 Mon Sep 17 00:00:00 2001 From: Carlo Caione Date: Thu, 20 Apr 2023 17:04:55 +0200 Subject: [PATCH] syscall: Introduce __syscall_always_inline 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 --- .clang-format | 1 + doc/conf.py | 1 + doc/zephyr.doxyfile.in | 1 + include/zephyr/toolchain/common.h | 2 ++ scripts/build/parse_syscalls.py | 10 +++++----- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.clang-format b/.clang-format index e5f69355cbe..fdcd735fe28 100644 --- a/.clang-format +++ b/.clang-format @@ -24,6 +24,7 @@ AttributeMacros: - __packed - __printf_like - __syscall + - __syscall_always_inline - __subsystem BitFieldColonSpacing: After BreakBeforeBraces: Linux diff --git a/doc/conf.py b/doc/conf.py index aeccbd204b0..497373060aa 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -232,6 +232,7 @@ breathe_default_members = ("members", ) cpp_id_attributes = [ "__syscall", + "__syscall_always_inline", "__deprecated", "__may_alias", "__used", diff --git a/doc/zephyr.doxyfile.in b/doc/zephyr.doxyfile.in index 0a066ace08e..50fc3e75304 100644 --- a/doc/zephyr.doxyfile.in +++ b/doc/zephyr.doxyfile.in @@ -2397,6 +2397,7 @@ PREDEFINED = __DOXYGEN__ \ "__printf_like(x, y)=" \ __attribute__(x)= \ __syscall= \ + __syscall_always_inline= \ __must_check= \ "ATOMIC_DEFINE(x, y)=atomic_t x[ATOMIC_BITMAP_SIZE(y)]" diff --git a/include/zephyr/toolchain/common.h b/include/zephyr/toolchain/common.h index 9259dc438ad..4f8708c427c 100644 --- a/include/zephyr/toolchain/common.h +++ b/include/zephyr/toolchain/common.h @@ -143,8 +143,10 @@ */ #ifndef ZTEST_UNITTEST #define __syscall static inline +#define __syscall_always_inline static inline __attribute__((always_inline)) #else #define __syscall +#define __syscall_always_inline #endif /* ZTEST_UNITTEST */ /* Definitions for struct declaration tags. These are sentinel values used by diff --git a/scripts/build/parse_syscalls.py b/scripts/build/parse_syscalls.py index 4385f5a8a9a..3536d52a9c4 100644 --- a/scripts/build/parse_syscalls.py +++ b/scripts/build/parse_syscalls.py @@ -33,11 +33,11 @@ import json regex_flags = re.MULTILINE | re.VERBOSE syscall_regex = re.compile(r''' -__syscall\s+ # __syscall attribute, must be first -([^(]+) # type and name of system call (split later) -[(] # Function opening parenthesis -([^)]*) # Arg list (split later) -[)] # Closing parenthesis +(?:__syscall|__syscall_always_inline)\s+ # __syscall attribute, must be first +([^(]+) # type and name of system call (split later) +[(] # Function opening parenthesis +([^)]*) # Arg list (split later) +[)] # Closing parenthesis ''', regex_flags) struct_tags = ["__subsystem", "__net_socket"]