Commit 110cf308 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Greg Kroah-Hartman

tools include: Move ARRAY_SIZE() to linux/kernel.h

commit 8607c1ee upstream.

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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d45e1f06
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
#include <assert.h> #include <assert.h>
#include <linux/compiler.h>
#ifndef UINT_MAX #ifndef UINT_MAX
#define UINT_MAX (~0U) #define UINT_MAX (~0U)
...@@ -76,6 +77,8 @@ ...@@ -76,6 +77,8 @@
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
int scnprintf(char * buf, size_t size, const char * fmt, ...); int scnprintf(char * buf, size_t size, const char * fmt, ...);
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
/* /*
* This looks more complex than it should be. But we need to * This looks more complex than it should be. But we need to
* get the type for the ~ right in round_down (it needs to be * get the type for the ~ right in round_down (it needs to be
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#endif #endif
#endif #endif
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#ifdef __GNUC__ #ifdef __GNUC__
#define TYPEOF(x) (__typeof__(x)) #define TYPEOF(x) (__typeof__(x))
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment