From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Huth Subject: Re: [kvm-unit-tests PATCH] Compile code with "-Wwrite-strings" Date: Wed, 28 Jun 2017 22:10:11 +0200 Message-ID: <8b1ae8b0-641a-e8cb-01e2-29fdb078caf3@redhat.com> References: <1498651457-19688-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: David Hildenbrand , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57266 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbdF1UKQ (ORCPT ); Wed, 28 Jun 2017 16:10:16 -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 F2EC08535D for ; Wed, 28 Jun 2017 20:10:15 +0000 (UTC) In-Reply-To: Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 28.06.2017 19:27, David Hildenbrand wrote: > On 28.06.2017 14:04, Thomas Huth wrote: >> So we make sure that we do not accidentially write to constant > > "accidentally" (I wouldn't know if Thunderbird wouldn't tell me ;) ) Oh, ok. Paolo, Radim, could you please fix it when picking up the patch? >> strings. Also add some missing "const" qualifiers in the code to >> avoid that we get compiler warnings now. >> >> Signed-off-by: Thomas Huth >> --- >> This patch supersedes my previous patch "Declare the prefix string >> variable in va_report() as const" >> >> Makefile | 2 +- >> lib/report.c | 6 +++--- >> x86/msr.c | 4 ++-- >> x86/pmu.c | 2 +- >> 4 files changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index 933b9f0..e79cf93 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -51,7 +51,7 @@ cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ >> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) >> >> CFLAGS += -g >> -CFLAGS += $(autodepend-flags) -Wall -Werror >> +CFLAGS += $(autodepend-flags) -Wall -Wwrite-strings -Werror > > > I assume this option has been around for quite some while, so no > reasonable gcc will spit fire. A very quick search revealed that it is at least 14 years old and GCC 4.4 already contained it. Likely even earlier versions. I think we do not really support older versions anymore, so that should be ok. > Reviewed-by: David Hildenbrand Thanks! Thomas