From: vkuznets at redhat.com (Vitaly Kuznetsov)
Subject: [PATCH v2] KVM: selftests: Compile code with warnings enabled
Date: Fri, 17 May 2019 11:41:11 +0200 [thread overview]
Message-ID: <8736ldquyw.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190517093000.GO16681@xz-x1>
Peter Xu <peterx at redhat.com> writes:
> On Fri, May 17, 2019 at 11:04:45AM +0200, Thomas Huth wrote:
>> So far the KVM selftests are compiled without any compiler warnings
>> enabled. That's quite bad, since we miss a lot of possible bugs this
>> way. Let's enable at least "-Wall" and some other useful warning flags
>> now, and fix at least the trivial problems in the code (like unused
>> variables).
>>
>> Signed-off-by: Thomas Huth <thuth at redhat.com>
>> ---
>> v2:
>> - Rebased to kvm/queue
>> - Fix warnings in state_test.c and evmcs_test.c, too
>
> I still see these warnings (probably because the hyperv_cpuid.c is a
> new test):
>
> In file included from x86_64/hyperv_cpuid.c:18:
> x86_64/hyperv_cpuid.c: In function ‘test_hv_cpuid’:
> x86_64/hyperv_cpuid.c:61:33: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
> TEST_ASSERT(entry->padding[0] == entry->padding[1]
> ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
> include/test_util.h:32:15: note: in definition of macro ‘TEST_ASSERT’
> test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
> ^
> x86_64/hyperv_cpuid.c:62:8: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
> TEST_ASSERT(entry->padding[0] == entry->padding[1]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> == entry->padding[2] == 0,
> ^~~~~~~~~~~~~~~~~~~~
> include/test_util.h:32:15: note: in definition of macro ‘TEST_ASSERT’
> test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
There's a fix from Dan Carpenter on the list:
https://marc.info/?l=kernel-janitors&m=155783012012532&w=2
> ^
> x86_64/hyperv_cpuid.c: In function ‘kvm_get_supported_hv_cpuid’:
> x86_64/hyperv_cpuid.c:93:6: warning: unused variable ‘ret’ [-Wunused-variable]
> int ret;
> ^~~
>
> The first two seem to be real bugs in the test code, and the 3rd one
> might need a cleanup too.
--
Vitaly
WARNING: multiple messages have this Message-ID (diff)
From: vkuznets@redhat.com (Vitaly Kuznetsov)
Subject: [PATCH v2] KVM: selftests: Compile code with warnings enabled
Date: Fri, 17 May 2019 11:41:11 +0200 [thread overview]
Message-ID: <8736ldquyw.fsf@vitty.brq.redhat.com> (raw)
Message-ID: <20190517094111.uTVUQouxYGgpBJv7VxMKaMOfYnK5VqVoRH8Ssh9g3Tk@z> (raw)
In-Reply-To: <20190517093000.GO16681@xz-x1>
Peter Xu <peterx at redhat.com> writes:
> On Fri, May 17, 2019@11:04:45AM +0200, Thomas Huth wrote:
>> So far the KVM selftests are compiled without any compiler warnings
>> enabled. That's quite bad, since we miss a lot of possible bugs this
>> way. Let's enable at least "-Wall" and some other useful warning flags
>> now, and fix at least the trivial problems in the code (like unused
>> variables).
>>
>> Signed-off-by: Thomas Huth <thuth at redhat.com>
>> ---
>> v2:
>> - Rebased to kvm/queue
>> - Fix warnings in state_test.c and evmcs_test.c, too
>
> I still see these warnings (probably because the hyperv_cpuid.c is a
> new test):
>
> In file included from x86_64/hyperv_cpuid.c:18:
> x86_64/hyperv_cpuid.c: In function ‘test_hv_cpuid’:
> x86_64/hyperv_cpuid.c:61:33: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
> TEST_ASSERT(entry->padding[0] == entry->padding[1]
> ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
> include/test_util.h:32:15: note: in definition of macro ‘TEST_ASSERT’
> test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
> ^
> x86_64/hyperv_cpuid.c:62:8: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
> TEST_ASSERT(entry->padding[0] == entry->padding[1]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> == entry->padding[2] == 0,
> ^~~~~~~~~~~~~~~~~~~~
> include/test_util.h:32:15: note: in definition of macro ‘TEST_ASSERT’
> test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
There's a fix from Dan Carpenter on the list:
https://marc.info/?l=kernel-janitors&m=155783012012532&w=2
> ^
> x86_64/hyperv_cpuid.c: In function ‘kvm_get_supported_hv_cpuid’:
> x86_64/hyperv_cpuid.c:93:6: warning: unused variable ‘ret’ [-Wunused-variable]
> int ret;
> ^~~
>
> The first two seem to be real bugs in the test code, and the 3rd one
> might need a cleanup too.
--
Vitaly
WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Peter Xu <peterx@redhat.com>, Thomas Huth <thuth@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
linux-kselftest@vger.kernel.org, kvm@vger.kernel.org,
"Shuah Khan" <shuah@kernel.org>,
"Andrew Jones" <drjones@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: selftests: Compile code with warnings enabled
Date: Fri, 17 May 2019 11:41:11 +0200 [thread overview]
Message-ID: <8736ldquyw.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190517093000.GO16681@xz-x1>
Peter Xu <peterx@redhat.com> writes:
> On Fri, May 17, 2019 at 11:04:45AM +0200, Thomas Huth wrote:
>> So far the KVM selftests are compiled without any compiler warnings
>> enabled. That's quite bad, since we miss a lot of possible bugs this
>> way. Let's enable at least "-Wall" and some other useful warning flags
>> now, and fix at least the trivial problems in the code (like unused
>> variables).
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> v2:
>> - Rebased to kvm/queue
>> - Fix warnings in state_test.c and evmcs_test.c, too
>
> I still see these warnings (probably because the hyperv_cpuid.c is a
> new test):
>
> In file included from x86_64/hyperv_cpuid.c:18:
> x86_64/hyperv_cpuid.c: In function ‘test_hv_cpuid’:
> x86_64/hyperv_cpuid.c:61:33: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
> TEST_ASSERT(entry->padding[0] == entry->padding[1]
> ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
> include/test_util.h:32:15: note: in definition of macro ‘TEST_ASSERT’
> test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
> ^
> x86_64/hyperv_cpuid.c:62:8: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
> TEST_ASSERT(entry->padding[0] == entry->padding[1]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> == entry->padding[2] == 0,
> ^~~~~~~~~~~~~~~~~~~~
> include/test_util.h:32:15: note: in definition of macro ‘TEST_ASSERT’
> test_assert((e), #e, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
There's a fix from Dan Carpenter on the list:
https://marc.info/?l=kernel-janitors&m=155783012012532&w=2
> ^
> x86_64/hyperv_cpuid.c: In function ‘kvm_get_supported_hv_cpuid’:
> x86_64/hyperv_cpuid.c:93:6: warning: unused variable ‘ret’ [-Wunused-variable]
> int ret;
> ^~~
>
> The first two seem to be real bugs in the test code, and the 3rd one
> might need a cleanup too.
--
Vitaly
next prev parent reply other threads:[~2019-05-17 9:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 9:04 [PATCH v2] KVM: selftests: Compile code with warnings enabled thuth
2019-05-17 9:04 ` Thomas Huth
2019-05-17 9:04 ` Thomas Huth
2019-05-17 9:30 ` peterx
2019-05-17 9:30 ` Peter Xu
2019-05-17 9:30 ` Peter Xu
2019-05-17 9:41 ` vkuznets [this message]
2019-05-17 9:41 ` Vitaly Kuznetsov
2019-05-17 9:41 ` Vitaly Kuznetsov
2019-05-17 10:07 ` thuth
2019-05-17 10:07 ` Thomas Huth
2019-05-17 10:07 ` Thomas Huth
2019-05-17 10:52 ` vkuznets
2019-05-17 10:52 ` Vitaly Kuznetsov
2019-05-17 10:52 ` Vitaly Kuznetsov
2019-05-20 10:00 ` pbonzini
2019-05-20 10:00 ` Paolo Bonzini
2019-05-20 10:00 ` Paolo Bonzini
2019-05-20 10:03 ` pbonzini
2019-05-20 10:03 ` Paolo Bonzini
2019-05-20 10:03 ` Paolo Bonzini
2019-05-23 9:11 ` drjones
2019-05-23 9:11 ` Andrew Jones
2019-05-23 9:11 ` Andrew Jones
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=8736ldquyw.fsf@vitty.brq.redhat.com \
--to=unknown@example.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.