Commit 0dff66f4 authored by Jai Menon's avatar Jai Menon Committed by Rémi Denis-Courmont

Provide a variant of the CALL macro which doesn't use the nested functions GNU C extension.

This is useful when building with compilers like clang+llvm which do not
plan on implementing this extension.
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 427d59f4
...@@ -109,6 +109,13 @@ static void *getsym (const char *name) ...@@ -109,6 +109,13 @@ static void *getsym (const char *name)
logbug(&counter, level, __func__, __VA_ARGS__); \ logbug(&counter, level, __func__, __VA_ARGS__); \
} while (0) } while (0)
#ifdef __clang__
#define CALL(func, ...) \
({ typeof (func) *sym = getsym ( # func); sym (__VA_ARGS__); })
#else
/* Evil non-standard GNU C macro ;) /* Evil non-standard GNU C macro ;)
* typeof keyword, * typeof keyword,
* statement-expression, * statement-expression,
...@@ -127,6 +134,7 @@ static void *getsym (const char *name) ...@@ -127,6 +134,7 @@ static void *getsym (const char *name)
sym (__VA_ARGS__); \ sym (__VA_ARGS__); \
}) })
#endif
/*** Environment *** /*** Environment ***
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment