Drop support for kernels < 3.0 from lib
[lttng-modules.git] / lib / bug.h
1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
2 *
3 * lib/bug.h
4 *
5 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 */
7
8 #ifndef _LTTNG_BUG_H
9 #define _LTTNG_BUG_H
10
11 /**
12 * BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime
13 * @condition: the condition which should be false.
14 *
15 * If the condition is a constant and true, the compiler will generate a build
16 * error. If the condition is not constant, a BUG will be triggered at runtime
17 * if the condition is ever true. If the condition is constant and false, no
18 * code is emitted.
19 */
20 #define BUILD_RUNTIME_BUG_ON(condition) \
21 do { \
22 if (__builtin_constant_p(condition)) \
23 BUILD_BUG_ON(condition); \
24 else \
25 BUG_ON(condition); \
26 } while (0)
27
28 #endif
This page took 0.030311 seconds and 4 git commands to generate.