perf bench futex: Fix build on musl + clang
Subsystems (2)
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: a0f213e14bb5cf4f190809b5811e1292bd614899 Gitweb: http://git.kernel.org/tip/a0f213e14bb5cf4f190809b5811e1292bd614899 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Thu, 2 Mar 2017 15:44:19 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 3 Mar 2017 19:07:19 -0300
perf bench futex: Fix build on musl + clang
When building with clang on a musl libc system, Alpine Linux, we end up hitting a problem where memset() is used but its prototype is not present, add it to avoid this:
bench/futex-wake.c:99:3: error: implicitly declaring library function 'memset' with type 'void *(void *, int, unsigned long)'
[-Werror,-Wimplicit-function-declaration]
CPU_ZERO(&cpu);
^
/usr/include/sched.h:127:23: note: expanded from macro 'CPU_ZERO'
#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
^
/usr/include/sched.h:110:30: note: expanded from macro 'CPU_ZERO_S'
#define CPU_ZERO_S(size,set) memset(set,0,size)
^
bench/futex-wake.c:99:3: note: include the header <string.h> or explicitly provide a declaration for 'memset'Found while updating my test build containers to build perf with clang in more systems.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/bench/futex-hash.c | 1 + tools/perf/bench/futex-lock-pi.c | 1 + tools/perf/bench/futex-requeue.c | 1 + tools/perf/bench/futex-wake-parallel.c | 1 + tools/perf/bench/futex-wake.c | 1 + 5 files changed, 5 insertions(+)
tools/perf/bench/futex-hash.c +1 -0
@@ -9,6 +9,7 @@*/ /* For the CLR_() macros */ +#include <string.h> #include <pthread.h> #include <errno.h>
tools/perf/bench/futex-lock-pi.c +1 -0
@@ -3,6 +3,7 @@*/ /* For the CLR_() macros */ +#include <string.h> #include <pthread.h> #include <signal.h>
tools/perf/bench/futex-requeue.c +1 -0
@@ -9,6 +9,7 @@*/ /* For the CLR_() macros */ +#include <string.h> #include <pthread.h> #include <signal.h>
tools/perf/bench/futex-wake-parallel.c +1 -0
@@ -8,6 +8,7 @@*/ /* For the CLR_() macros */ +#include <string.h> #include <pthread.h> #include <signal.h>
tools/perf/bench/futex-wake.c +1 -0
@@ -9,6 +9,7 @@*/ /* For the CLR_() macros */ +#include <string.h> #include <pthread.h> #include <signal.h>