From: David Hildenbrand Subject: Re: [kvm-unit-tests PATCH] Declare the prefix string variable in va_report() as const Date: Tue, 27 Jun 2017 10:37:06 +0200 Message-ID: References: <1498540173-3030-1-git-send-email-thuth@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Drew Jones To: Thomas Huth , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:48606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751513AbdF0IhJ (ORCPT ); Tue, 27 Jun 2017 04:37:09 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 27DDE7D0E9 for ; Tue, 27 Jun 2017 08:37:09 +0000 (UTC) In-Reply-To: <1498540173-3030-1-git-send-email-thuth@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: 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 > --- > 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