kernel: make 'static inline' implicit to __syscall

The fact that these are all static inline functions internally is an
implementation detail.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-09-29 14:17:47 -07:00 committed by Andrew Boie
commit 9928023421
4 changed files with 23 additions and 15 deletions

View file

@ -2505,9 +2505,8 @@ struct k_sem {
*
* @return N/A
*/
__syscall static inline void k_sem_init(struct k_sem *sem,
unsigned int initial_count,
unsigned int limit);
__syscall void k_sem_init(struct k_sem *sem, unsigned int initial_count,
unsigned int limit);
/**
* @brief Take a semaphore.
@ -2530,7 +2529,7 @@ __syscall static inline void k_sem_init(struct k_sem *sem,
* @retval -EBUSY Returned without waiting.
* @retval -EAGAIN Waiting period timed out.
*/
__syscall static inline int k_sem_take(struct k_sem *sem, s32_t timeout);
__syscall int k_sem_take(struct k_sem *sem, s32_t timeout);
/**
* @brief Give a semaphore.
@ -2544,7 +2543,7 @@ __syscall static inline int k_sem_take(struct k_sem *sem, s32_t timeout);
*
* @return N/A
*/
__syscall static inline void k_sem_give(struct k_sem *sem);
__syscall void k_sem_give(struct k_sem *sem);
/**
* @brief Reset a semaphore's count to zero.
@ -2555,7 +2554,7 @@ __syscall static inline void k_sem_give(struct k_sem *sem);
*
* @return N/A
*/
__syscall_inline static inline void k_sem_reset(struct k_sem *sem);
__syscall_inline void k_sem_reset(struct k_sem *sem);
static inline void _impl_k_sem_reset(struct k_sem *sem)
{
@ -2571,7 +2570,7 @@ static inline void _impl_k_sem_reset(struct k_sem *sem)
*
* @return Current semaphore count.
*/
__syscall_inline static inline unsigned int k_sem_count_get(struct k_sem *sem);
__syscall_inline unsigned int k_sem_count_get(struct k_sem *sem);
static inline unsigned int _impl_k_sem_count_get(struct k_sem *sem)
{

View file

@ -106,6 +106,12 @@
#define _DO_CONCAT(x, y) x ## y
#define _CONCAT(x, y) _DO_CONCAT(x, y)
/* Additionally used as a sentinel by gen_syscalls.py to identify what
* functions are system calls
*/
#define __syscall static inline
#define __syscall_inline static inline
#ifndef BUILD_ASSERT
/* compile-time assertion that makes the build fail */
#define BUILD_ASSERT(EXPR) typedef char __build_assert_failure[(EXPR) ? 1 : -1]

View file

@ -95,10 +95,6 @@ do { \
#define __deprecated __attribute__((deprecated))
#define ARG_UNUSED(x) (void)(x)
/* Only used by gen_syscalls.py */
#define __syscall
#define __syscall_inline
#define likely(x) __builtin_expect((long)!!(x), 1L)
#define unlikely(x) __builtin_expect((long)!!(x), 0L)

View file

@ -12,7 +12,6 @@ import os
api_regex = re.compile(r'''
__(syscall|syscall_inline)\s+ # __syscall or __syscall_inline
static\s+inline\s+ # All prototypes are static inline functions
([^(]+) # type and name of system call (split later)
[(] # Function opening parenthesis
([^)]*) # Arg list (split later)
@ -33,7 +32,11 @@ def typename_split(item):
if "(" in item:
raise SyscallParseException("Please use typedefs for function pointers")
m = typename_regex.match(item).groups()
mo = typename_regex.match(item)
if not mo:
raise SyscallParseException("Malformed system call invocation")
m = mo.groups()
return (m[0].strip(), m[1])
@ -84,10 +87,14 @@ def analyze_headers(base_path):
for root, dirs, files in os.walk(base_path):
for fn in files:
if not fn.endswith(".h"):
# toolchain/common.h has the definition of __syscall which we
# don't want to trip over
path = os.path.join(root, fn)
if not fn.endswith(".h") or path.endswith("toolchain/common.h"):
continue
with open(os.path.join(root, fn)) as fp:
with open(path, "r") as fp:
try:
result = [analyze_fn(mo.groups(), fn)
for mo in api_regex.finditer(fp.read())]