blob: 6df2c4dab3b3a01aa6379430bb8486b2bca0fef5 [file] [log] [blame]
commit ce27c888c66dbf8e0046c322bbc2b883c3398d92
Author: George Burgess IV <gbiv@google.com>
Date: Sat Apr 18 16:02:56 2020 +1000
tools/build: tweak unused value workaround
Clang has -Wself-assign enabled by default under -Wall, which always gets
-Werror'ed on this file, causing sync-compare-and-swap to be disabled by
default. The generally-accepted way to spell "this value is intentionally
unused," is casting it to `void`. This is accepted by both GCC and Clang
with -Wall enabled: https://godbolt.org/z/qqZ9r3
Link: http://lkml.kernel.org/r/20200414195638.156123-1-gbiv@google.com
Signed-off-by: George Burgess IV <gbiv@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
diff --git a/tools/build/feature/test-sync-compare-and-swap.c b/tools/build/feature/test-sync-compare-and-swap.c
index 1e38d1930a97..3bc6b0768a53 100644
--- a/tools/build/feature/test-sync-compare-and-swap.c
+++ b/tools/build/feature/test-sync-compare-and-swap.c
@@ -7,7 +7,7 @@ int main(int argc, char *argv[])
{
uint64_t old, new = argc;
- argv = argv;
+ (void)argv;
do {
old = __sync_val_compare_and_swap(&x, 0, 0);
} while (!__sync_bool_compare_and_swap(&x, old, new));