X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fbug.hpp;h=758fcf70c5be9d176ac6f5e97ad1963dde1b7d20;hb=HEAD;hp=f77c775a7ff23a190ad36808ff429645e77f9dc3;hpb=c9e313bc594f40a86eed237dce222c0fc99c957f;p=lttng-tools.git diff --git a/src/common/bug.hpp b/src/common/bug.hpp index f77c775a7..758fcf70c 100644 --- a/src/common/bug.hpp +++ b/src/common/bug.hpp @@ -8,22 +8,19 @@ #ifndef _LTTNG_BUG_H #define _LTTNG_BUG_H -#include #include #include +#include -#define LTTNG_BUG_ON(condition) \ - do { \ - if (caa_unlikely(condition)) { \ - fprintf(stderr, \ - "LTTng BUG in file %s, line %d.\n", \ - __FILE__, __LINE__); \ - exit(EXIT_FAILURE); \ - } \ +#define LTTNG_BUG_ON(condition) \ + do { \ + if (caa_unlikely(condition)) { \ + fprintf(stderr, "LTTng BUG in file %s, line %d.\n", __FILE__, __LINE__); \ + exit(EXIT_FAILURE); \ + } \ } while (0) -#define LTTNG_BUILD_BUG_ON(condition) \ - ((void) sizeof(char[-!!(condition)])) +#define LTTNG_BUILD_BUG_ON(condition) ((void) sizeof(char[-!!(condition)])) /** * LTTNG_BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime @@ -34,12 +31,12 @@ * if the condition is ever true. If the condition is constant and false, no * code is emitted. */ -#define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \ - do { \ - if (__builtin_constant_p(condition)) \ - LTTNG_BUILD_BUG_ON(condition); \ - else \ - LTTNG_BUG_ON(condition); \ +#define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \ + do { \ + if (__builtin_constant_p(condition)) \ + LTTNG_BUILD_BUG_ON(condition); \ + else \ + LTTNG_BUG_ON(condition); \ } while (0) #endif