From: Nathan Chancellor <nathan@kernel.org>
To: Anders Roxell <anders.roxell@linaro.org>
Cc: shuah@kernel.org, ndesaulniers@google.com,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH v2] selftests: vDSO: parse: warning: fix assignment as a condition
Date: Mon, 6 Dec 2021 09:24:35 -0700 [thread overview]
Message-ID: <Ya45Q9hLPIaociYW@archlinux-ax161> (raw)
In-Reply-To: <20211206102931.1433871-1-anders.roxell@linaro.org>
On Mon, Dec 06, 2021 at 11:29:31AM +0100, Anders Roxell wrote:
> 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.
This part of the commit message does not line up with what you are
actually doing now.
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
With that fixed:
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> v1 -> v2: fixed checkpatch warnings
>
> tools/testing/selftests/vDSO/parse_vdso.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
> index 413f75620a35..fdd38f7e0e43 100644
> --- a/tools/testing/selftests/vDSO/parse_vdso.c
> +++ b/tools/testing/selftests/vDSO/parse_vdso.c
> @@ -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;
> }
> --
> 2.33.0
>
prev parent reply other threads:[~2021-12-06 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-06 10:29 [PATCH v2] selftests: vDSO: parse: warning: fix assignment as a condition Anders Roxell
2021-12-06 16:24 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ya45Q9hLPIaociYW@archlinux-ax161 \
--to=nathan@kernel.org \
--cc=anders.roxell@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox