History

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.

Shuah Khan committed 4 years ago

Commit 066b34a1 parent a738a4c3 files · +8 −0Browse files

Showing the changes to tools/include/linux (1 of 3 files). Show all

Unified · Split

tools/include/linux/kernel.h+2−0
@@ -92,7 +92,9 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); · 91 unmodified lines
92int scnprintf(char * buf, size_t size, const char * fmt, ...);92int scnprintf(char * buf, size_t size, const char * fmt, ...);
93int scnprintf_pad(char * buf, size_t size, const char * fmt, ...);93int scnprintf_pad(char * buf, size_t size, const char * fmt, ...);
94 94
95#ifndef ARRAY_SIZE
95#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))96#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
97#endif
96 98
97#define current_gfp_context(k) 099#define current_gfp_context(k) 0
98#define synchronize_rcu()100#define synchronize_rcu()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t