From 379d61b1c7d42512cded04d372f15a7e725db9e1 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 17 Apr 2017 11:23:41 -0300 Subject: tools include: Introduce linux/bug.h, from the kernel sources With just what we will need in the upcoming changesets, the BUILD_BUG_ON_ZERO() definition. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-lw8zg7x6ttwcvqhp90mwe3vo@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/linux/bug.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tools/include/linux/bug.h (limited to 'tools/include/linux') diff --git a/tools/include/linux/bug.h b/tools/include/linux/bug.h new file mode 100644 index 0000000..8e4a4f4 --- /dev/null +++ b/tools/include/linux/bug.h @@ -0,0 +1,10 @@ +#ifndef _TOOLS_PERF_LINUX_BUG_H +#define _TOOLS_PERF_LINUX_BUG_H + +/* Force a compilation error if condition is true, but also produce a + result (of value 0 and type size_t), so the expression can be used + e.g. in a structure initializer (or where-ever else comma expressions + aren't permitted). */ +#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) + +#endif /* _TOOLS_PERF_LINUX_BUG_H */ -- cgit v1.1