diff options
author | 2021-12-08 10:47:42 -0700 | |
---|---|---|
committer | 2021-12-10 17:50:17 -0700 | |
commit | 066b34aa5461f6072dbbecb690f4fe446b736ebf (patch) | |
tree | 17eb5e4f0c9a0058804ec152fb0b9d360da1df4f /tools/include | |
parent | selftests: cgroup: build error multiple outpt files (diff) | |
download | linux-066b34aa5461f6072dbbecb690f4fe446b736ebf.tar.gz linux-066b34aa5461f6072dbbecb690f4fe446b736ebf.tar.bz2 linux-066b34aa5461f6072dbbecb690f4fe446b736ebf.zip |
tools: fix ARRAY_SIZE defines in tools and selftests hdrs
tools/include/linux/kernel.h and kselftest_harness.h are missing
ifndef guard around ARRAY_SIZE define. Fix them to avoid duplicate
define errors during compile when another file defines it. This
problem was found when compiling selftests that include a header
with ARRAY_SIZE define.
ARRAY_SIZE is defined in several selftests. There are about 25+
duplicate defines in various selftests source and header files.
Add ARRAY_SIZE to kselftest.h in preparation for removing duplicate
ARRAY_SIZE defines from individual test files.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/include')
-rw-r--r-- | tools/include/linux/kernel.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index 3e8df500cfbd..9701e8307db0 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h @@ -92,7 +92,9 @@ 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_pad(char * buf, size_t size, const char * fmt, ...); +#ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#endif #define current_gfp_context(k) 0 #define synchronize_rcu() |