2 * Copyright (C) 2010-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 * SPDX-License-Identifier: MIT
13 #include <urcu/compiler.h>
15 #define LTTNG_BUG_ON(condition) \
17 if (caa_unlikely(condition)) { \
18 fprintf(stderr, "LTTng BUG in file %s, line %d.\n", __FILE__, __LINE__); \
23 #define LTTNG_BUILD_BUG_ON(condition) ((void) sizeof(char[-!!(condition)]))
26 * LTTNG_BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime
27 * @condition: the condition which should be false.
29 * If the condition is a constant and true, the compiler will generate a build
30 * error. If the condition is not constant, a BUG will be triggered at runtime
31 * if the condition is ever true. If the condition is constant and false, no
34 #define LTTNG_BUILD_RUNTIME_BUG_ON(condition) \
36 if (__builtin_constant_p(condition)) \
37 LTTNG_BUILD_BUG_ON(condition); \
39 LTTNG_BUG_ON(condition); \