Skip to content

Commit a21151b

Browse files
gburgessivtorvalds
authored andcommitted
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 Signed-off-by: George Burgess IV <gbiv@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Link: http://lkml.kernel.org/r/20200414195638.156123-1-gbiv@google.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 461e156 commit a21151b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/build/feature/test-sync-compare-and-swap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int main(int argc, char *argv[])
77
{
88
uint64_t old, new = argc;
99

10-
argv = argv;
10+
(void)argv;
1111
do {
1212
old = __sync_val_compare_and_swap(&x, 0, 0);
1313
} while (!__sync_bool_compare_and_swap(&x, old, new));

0 commit comments

Comments
 (0)