aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/linux/kernel.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-04-17 10:29:26 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-04-19 12:01:43 -0400
commit8607c1ee734d12f62c6a46abef13a510e25a1839 (patch)
tree0e860bf17795004b3d609085a10f9beffd7dd595 /tools/include/linux/kernel.h
parentf6441aff8946f7fd6ab730d7eb9eba18a9ebeba4 (diff)
tools include: Move ARRAY_SIZE() to linux/kernel.h
To match the kernel, then look for places redefining it to make it use this version, which checks that its parameter is an array at build time. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-txlcf1im83bcbj6kh0wxmyy8@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include/linux/kernel.h')
-rw-r--r--tools/include/linux/kernel.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index adb4d0147755..73ccc48126bb 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -4,6 +4,7 @@
4#include <stdarg.h> 4#include <stdarg.h>
5#include <stddef.h> 5#include <stddef.h>
6#include <assert.h> 6#include <assert.h>
7#include <linux/compiler.h>
7 8
8#ifndef UINT_MAX 9#ifndef UINT_MAX
9#define UINT_MAX (~0U) 10#define UINT_MAX (~0U)
@@ -76,6 +77,8 @@
76int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); 77int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
77int scnprintf(char * buf, size_t size, const char * fmt, ...); 78int scnprintf(char * buf, size_t size, const char * fmt, ...);
78 79
80#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
81
79/* 82/*
80 * This looks more complex than it should be. But we need to 83 * This looks more complex than it should be. But we need to
81 * get the type for the ~ right in round_down (it needs to be 84 * get the type for the ~ right in round_down (it needs to be