X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ftestpoint%2Ftestpoint.h;h=dc5be832b04b7dfb8696802e7179860345e16274;hp=ba3af8a5370a7c6155e46e480b105fc16e2f2a15;hb=6993eeb37fb4caf9b92c09d4ab1730dcc2b8b097;hpb=28d96b8c01104f96bb27b93bec0cd4a4a0532d21 diff --git a/src/common/testpoint/testpoint.h b/src/common/testpoint/testpoint.h index ba3af8a53..dc5be832b 100644 --- a/src/common/testpoint/testpoint.h +++ b/src/common/testpoint/testpoint.h @@ -31,38 +31,38 @@ void *lttng_testpoint_lookup(const char *name); /* * Testpoint is only active if the global lttng_testpoint_activated flag is * set. + * Return a non-zero error code to indicate failure. */ -#define testpoint(name) \ - do { \ - if (caa_unlikely(lttng_testpoint_activated)) { \ - __testpoint_##name##_wrapper(); \ - } \ - } while (0) +#define testpoint(name) \ + ((caa_unlikely(lttng_testpoint_activated)) \ + ? __testpoint_##name##_wrapper() : 0) /* * One wrapper per testpoint is generated. This is to keep track of the symbol * lookup status and the corresponding function pointer, if any. */ #define _TESTPOINT_DECL(_name) \ - static inline void __testpoint_##_name##_wrapper(void) \ + static inline int __testpoint_##_name##_wrapper(void) \ { \ - static void (*tp)(void); \ + int ret = 0; \ + static int (*tp)(void); \ static int found; \ const char *tp_name = "__testpoint_" #_name; \ \ if (tp) { \ - tp(); \ + ret = tp(); \ } else { \ if (!found) { \ tp = lttng_testpoint_lookup(tp_name); \ if (tp) { \ found = 1; \ - tp(); \ + ret = tp(); \ } else { \ found = -1; \ } \ } \ } \ + return ret; \ } /* Testpoint declaration */