selftests: vDSO: parse: warning: fix assignment as a condition
Subsystems (2)
PATCH 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 /home/anders/.cache/tuxmake/builds/current/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.
--- tools/testing/selftests/vDSO/parse_vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/vDSO/parse_vdso.c +1 -1
@@ -62,7 +62,7 @@ static unsigned long elf_hash(const unsigned char *name)while (*name) { h = (h <<4 ) + *name++; -if (g = h &0xf0000000 ) +if ((g = (h &0xf0000000 ))) h ^= g >>24 ; h &= ~g; }
Signature · 1 line
2.33.0
Quoted 11 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/home/anders/.cache/tuxmake/builds/current/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.
Signed-off-by Anders Roxell <[email protected]>
Thanks for the patch!
Quoted 20 lines
--- tools/testing/selftests/vDSO/parse_vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/vDSO/parse_vdso.c +1
-2@@ -62,7 +62,7 @@ static unsigned long elf_hash(const unsigned char *name)while (*name) { h = (h <<4 ) + *name++; -if (g = h &0xf0000000 ) +if ((g = (h &0xf0000000 ))) h ^= g >>24 ; h &= ~g; } --2.33.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Shuah Khan
maintainerQuoted 9 lines · Nick Desaulniers
Quoted 8 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/home/anders/.cache/tuxmake/builds/current/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) ~~^~~~~~~~~~~~~~~~
Quoted 7 lines
Quoted 3 lines
Rework to a parentheses before doing the check.
Signed-off-by Anders Roxell <[email protected]>Thanks for the patch!
Reviewed-by Nick Desaulniers <[email protected]>
My commit script failed due to checkpatch warns. Run checkpatchp.l --strict to find the problems and send me the fixed version.
thanks,
-- Shuah