Cleanup tracepoint.c
[lttng-ust.git] / include / lttng / bug.h
CommitLineData
44d13f19
MD
1#ifndef _LTTNG_BUG_H
2#define _LTTNG_BUG_H
3
4/*
5 * lib/bug.h
6 *
7 * (C) Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
a60d70e6
MD
9 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
10 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
11 *
12 * Permission is hereby granted to use or copy this program
13 * for any purpose, provided the above notices are retained on all copies.
14 * Permission to modify the code and to distribute modified code is granted,
15 * provided the above notices are retained, and a notice that the code was
16 * modified is included with the above copyright notice.
17 *
44d13f19
MD
18 */
19
a6352fd4
MD
20#define BUILD_BUG_ON(condition) \
21 ((void) sizeof(char[-!!(condition)]))
22
44d13f19
MD
23/**
24 * BUILD_RUNTIME_BUG_ON - check condition at build (if constant) or runtime
25 * @condition: the condition which should be false.
26 *
27 * If the condition is a constant and true, the compiler will generate a build
28 * error. If the condition is not constant, a BUG will be triggered at runtime
29 * if the condition is ever true. If the condition is constant and false, no
30 * code is emitted.
31 */
32#define BUILD_RUNTIME_BUG_ON(condition) \
33 do { \
34 if (__builtin_constant_p(condition)) \
35 BUILD_BUG_ON(condition); \
36 else \
37 BUG_ON(condition); \
38 } while (0)
39
40#endif
This page took 0.024538 seconds and 4 git commands to generate.