Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf bench futex: Use __maybe_unused

Instead of attributing a variable to itself to silence the compiler, use
the attribute designed for that, avoiding this:

In file included from bench/futex-hash.c:24:
bench/futex.h:95:7: error: explicitly assigning value of variable of type 'pthread_attr_t *' to itself [-Werror,-Wself-assign]
attr = attr;
~~~~ ^ ~~~~
bench/futex.h:96:13: error: explicitly assigning value of variable of type 'size_t' (aka 'unsigned long') to itself [-Werror,-Wself-assign]
cpusetsize = cpusetsize;
~~~~~~~~~~ ^ ~~~~~~~~~~
bench/futex.h:97:9: error: explicitly assigning value of variable of type 'cpu_set_t *' (aka 'struct cpu_set_t *') to itself [-Werror,-Wself-assign]
cpuset = cpuset;
~~~~~~ ^ ~~~~~~

That is only triggered when HAVE_PTHREAD_ATTR_SETAFFINITY_NP isn't set.

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-14ws1d1elj2d5ej8g7cwdqau@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+4 -6
+4 -6
tools/perf/bench/futex.h
··· 88 88 89 89 #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP 90 90 #include <pthread.h> 91 - static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr, 92 - size_t cpusetsize, 93 - cpu_set_t *cpuset) 91 + #include <linux/compiler.h> 92 + static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr __maybe_unused, 93 + size_t cpusetsize __maybe_unused, 94 + cpu_set_t *cpuset __maybe_unused) 94 95 { 95 - attr = attr; 96 - cpusetsize = cpusetsize; 97 - cpuset = cpuset; 98 96 return 0; 99 97 } 100 98 #endif