Command to regenerate the metadata of a session
[deliverable/lttng-modules.git] / lib / bug.h
1 #ifndef _LTTNG_BUG_H
2 #define _LTTNG_BUG_H
3
4 /*
5 * lib/bug.h
6 *
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; only
12 * version 2.1 of the License.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 /**
25 * BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime
26 * @condition: the condition which should be false.
27 *
28 * If the condition is a constant and true, the compiler will generate a build
29 * error. If the condition is not constant, a BUG will be triggered at runtime
30 * if the condition is ever true. If the condition is constant and false, no
31 * code is emitted.
32 */
33 #define BUILD_RUNTIME_BUG_ON(condition) \
34 do { \
35 if (__builtin_constant_p(condition)) \
36 BUILD_BUG_ON(condition); \
37 else \
38 BUG_ON(condition); \
39 } while (0)
40
41 #endif
This page took 0.032723 seconds and 5 git commands to generate.