Commit d9fc3851 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

override: simplify CALL()

parent 1403deb8
...@@ -109,32 +109,12 @@ static void *getsym (const char *name) ...@@ -109,32 +109,12 @@ 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
* nested function...
*/ */
#define CALL(func, ...) \ #define CALL(func, ...) \
({ \ ({ typeof (func) *sym = getsym ( # func); sym (__VA_ARGS__); })
static typeof (func) *sym = NULL; \
static pthread_once_t once = PTHREAD_ONCE_INIT; \
auto void getsym_once (void); \
void getsym_once (void) \
{ \
sym = getsym ( # func); \
} \
pthread_once (&once, getsym_once); \
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