selftests: vDSO: parse: warning: fix assignment as a condition
Subsystems (2)
PATCH v2 1/1 selftests: vDSO: parse: warning: fix assignment as a condition
When building selftests/vDSO with clang the following warning shows up:
clang -std=gnu99 -Wno-pointer-sign vdso_test_gettimeofday.c parse_vdso.c \
-o /tmp/kselftest/vDSO/vdso_test_gettimeofday
parse_vdso.c:65:9: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (g = h & 0xf0000000)
~~^~~~~~~~~~~~~~~~Rework to a parentheses before doing the check.
---
v1 -> v2: fixed checkpatch warnings
tools/testing/selftests/vDSO/parse_vdso.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/vDSO/parse_vdso.c +2 -1
@@ -62,7 +62,8 @@ static unsigned long elf_hash(const unsigned char *name)while (*name) { h = (h <<4 ) + *name++; -if (g = h &0xf0000000 ) + g = h &0xf0000000 ; +if (g) h ^= g >>24 ; h &= ~g; }
Signature · 1 line
2.33.0
Quoted 9 lines · Anders Roxell
When building selftests/vDSO with clang the following warning shows up:
clang -std=gnu99 -Wno-pointer-sign
vdso_test_gettimeofday.cparse_vdso.c\
-o/tmp/kselftest/vDSO/vdso_test_gettimeofday
parse_vdso.c:65:9: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]if (g = h & 0xf0000000) ~~^~~~~~~~~~~~~~~~Rework to a parentheses before doing the check.
This part of the commit message does not line up with what you are actually doing now.
Quoted 2 lines
Signed-off-by Anders Roxell <[email protected]>Reviewed-by Nick Desaulniers <[email protected]>
With that fixed:
Quoted 24 lines
---
v1 -> v2: fixed checkpatch warnings
tools/testing/selftests/vDSO/parse_vdso.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/vDSO/parse_vdso.c +2
-1@@ -62,7 +62,8 @@ static unsigned long elf_hash(const unsigned char *name)while (*name) { h = (h <<4 ) + *name++; -if (g = h &0xf0000000 ) + g = h &0xf0000000 ; +if (g) h ^= g >>24 ; h &= ~g; }Signature · 1 line
2.33.0