* [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const
@ 2017-06-27 5:09 Thomas Huth
2017-06-27 8:37 ` David Hildenbrand
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2017-06-27 5:09 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Radim Krčmář, Drew Jones
This way, the code can be compiled with "-Wwrite-strings", too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
Not sure whether we want to enable "-Wwrite-strings" globally (since
strings in kvm-unit-test are theoretically writable if the test is
running without MMU), so I only fixed the code here, without adding
it to the Makefile. But if we agree that it is a good idea I can
respin the patch and add it to the Makefile, too.
lib/report.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/report.c b/lib/report.c
index b002d21..c0a701f 100644
--- a/lib/report.c
+++ b/lib/report.c
@@ -81,9 +81,9 @@ void report_prefix_pop(void)
static void va_report(const char *msg_fmt,
bool pass, bool xfail, bool skip, va_list va)
{
- char *prefix = skip ? "SKIP"
- : xfail ? (pass ? "XPASS" : "XFAIL")
- : (pass ? "PASS" : "FAIL");
+ const char *prefix = skip ? "SKIP"
+ : xfail ? (pass ? "XPASS" : "XFAIL")
+ : (pass ? "PASS" : "FAIL");
spin_lock(&lock);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const
2017-06-27 5:09 [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const Thomas Huth
@ 2017-06-27 8:37 ` David Hildenbrand
2017-06-27 8:39 ` Thomas Huth
0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2017-06-27 8:37 UTC (permalink / raw)
To: Thomas Huth, kvm; +Cc: Paolo Bonzini, Radim Krčmář, Drew Jones
On 27.06.2017 07:09, Thomas Huth wrote:
> This way, the code can be compiled with "-Wwrite-strings", too.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> Not sure whether we want to enable "-Wwrite-strings" globally (since
> strings in kvm-unit-test are theoretically writable if the test is
> running without MMU), so I only fixed the code here, without adding
> it to the Makefile. But if we agree that it is a good idea I can
> respin the patch and add it to the Makefile, too.
Make sense to me. I'd vote for adding it as long as all targets can be
compiled without any problems.
>
> lib/report.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/report.c b/lib/report.c
> index b002d21..c0a701f 100644
> --- a/lib/report.c
> +++ b/lib/report.c
> @@ -81,9 +81,9 @@ void report_prefix_pop(void)
> static void va_report(const char *msg_fmt,
> bool pass, bool xfail, bool skip, va_list va)
> {
> - char *prefix = skip ? "SKIP"
> - : xfail ? (pass ? "XPASS" : "XFAIL")
> - : (pass ? "PASS" : "FAIL");
> + const char *prefix = skip ? "SKIP"
> + : xfail ? (pass ? "XPASS" : "XFAIL")
> + : (pass ? "PASS" : "FAIL");
Hmm, think I liked the old indentation better. (":" directly below the
matching "?")
>
> spin_lock(&lock);
>
>
--
Thanks,
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const
2017-06-27 8:37 ` David Hildenbrand
@ 2017-06-27 8:39 ` Thomas Huth
2017-06-27 11:39 ` Andrew Jones
2017-06-27 12:30 ` Paolo Bonzini
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Huth @ 2017-06-27 8:39 UTC (permalink / raw)
To: David Hildenbrand, kvm
Cc: Paolo Bonzini, Radim Krčmář, Drew Jones
On 27.06.2017 10:37, David Hildenbrand wrote:
> On 27.06.2017 07:09, Thomas Huth wrote:
>> This way, the code can be compiled with "-Wwrite-strings", too.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> Not sure whether we want to enable "-Wwrite-strings" globally (since
>> strings in kvm-unit-test are theoretically writable if the test is
>> running without MMU), so I only fixed the code here, without adding
>> it to the Makefile. But if we agree that it is a good idea I can
>> respin the patch and add it to the Makefile, too.
>
> Make sense to me. I'd vote for adding it as long as all targets can be
> compiled without any problems.
>
>>
>> lib/report.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/report.c b/lib/report.c
>> index b002d21..c0a701f 100644
>> --- a/lib/report.c
>> +++ b/lib/report.c
>> @@ -81,9 +81,9 @@ void report_prefix_pop(void)
>> static void va_report(const char *msg_fmt,
>> bool pass, bool xfail, bool skip, va_list va)
>> {
>> - char *prefix = skip ? "SKIP"
>> - : xfail ? (pass ? "XPASS" : "XFAIL")
>> - : (pass ? "PASS" : "FAIL");
>> + const char *prefix = skip ? "SKIP"
>> + : xfail ? (pass ? "XPASS" : "XFAIL")
>> + : (pass ? "PASS" : "FAIL");
>
> Hmm, think I liked the old indentation better. (":" directly below the
> matching "?")
Oh, right, thanks! That apparently happens when sending patches too
early in the morning ;-)
I'll wait for some more comments about whether to include
"-Wwrite-strings" or not, then I'll respin this patch.
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const
2017-06-27 8:39 ` Thomas Huth
@ 2017-06-27 11:39 ` Andrew Jones
2017-06-27 12:30 ` Paolo Bonzini
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2017-06-27 11:39 UTC (permalink / raw)
To: Thomas Huth
Cc: David Hildenbrand, kvm, Paolo Bonzini, Radim Krčmář
On Tue, Jun 27, 2017 at 10:39:39AM +0200, Thomas Huth wrote:
> On 27.06.2017 10:37, David Hildenbrand wrote:
> > On 27.06.2017 07:09, Thomas Huth wrote:
> >> This way, the code can be compiled with "-Wwrite-strings", too.
> >>
> >> Signed-off-by: Thomas Huth <thuth@redhat.com>
> >> ---
> >> Not sure whether we want to enable "-Wwrite-strings" globally (since
> >> strings in kvm-unit-test are theoretically writable if the test is
> >> running without MMU), so I only fixed the code here, without adding
> >> it to the Makefile. But if we agree that it is a good idea I can
> >> respin the patch and add it to the Makefile, too.
> >
> > Make sense to me. I'd vote for adding it as long as all targets can be
> > compiled without any problems.
> >
> >>
> >> lib/report.c | 6 +++---
> >> 1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/lib/report.c b/lib/report.c
> >> index b002d21..c0a701f 100644
> >> --- a/lib/report.c
> >> +++ b/lib/report.c
> >> @@ -81,9 +81,9 @@ void report_prefix_pop(void)
> >> static void va_report(const char *msg_fmt,
> >> bool pass, bool xfail, bool skip, va_list va)
> >> {
> >> - char *prefix = skip ? "SKIP"
> >> - : xfail ? (pass ? "XPASS" : "XFAIL")
> >> - : (pass ? "PASS" : "FAIL");
> >> + const char *prefix = skip ? "SKIP"
> >> + : xfail ? (pass ? "XPASS" : "XFAIL")
> >> + : (pass ? "PASS" : "FAIL");
> >
> > Hmm, think I liked the old indentation better. (":" directly below the
> > matching "?")
>
> Oh, right, thanks! That apparently happens when sending patches too
> early in the morning ;-)
> I'll wait for some more comments about whether to include
> "-Wwrite-strings" or not, then I'll respin this patch.
I vote turn it on globally, and then if a unit test is introduced where
it needs to be off, then that's the beauty of having it fine grained,
that unit test can modify its make target accordingly to remove it.
Thanks,
drew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const
2017-06-27 8:39 ` Thomas Huth
2017-06-27 11:39 ` Andrew Jones
@ 2017-06-27 12:30 ` Paolo Bonzini
1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2017-06-27 12:30 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, kvm
Cc: Radim Krčmář, Drew Jones
On 27/06/2017 10:39, Thomas Huth wrote:
> Oh, right, thanks! That apparently happens when sending patches too
> early in the morning ;-)
> I'll wait for some more comments about whether to include
> "-Wwrite-strings" or not, then I'll respin this patch.
Yes, please do.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-27 12:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 5:09 [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const Thomas Huth
2017-06-27 8:37 ` David Hildenbrand
2017-06-27 8:39 ` Thomas Huth
2017-06-27 11:39 ` Andrew Jones
2017-06-27 12:30 ` Paolo Bonzini
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.