From patchwork Thu Jun 29 18:42:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 9817721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D3FD6020A for ; Thu, 29 Jun 2017 18:43:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6306D28786 for ; Thu, 29 Jun 2017 18:43:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57A6528788; Thu, 29 Jun 2017 18:43:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2B1C28786 for ; Thu, 29 Jun 2017 18:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753250AbdF2SnQ (ORCPT ); Thu, 29 Jun 2017 14:43:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55196 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752868AbdF2SnP (ORCPT ); Thu, 29 Jun 2017 14:43:15 -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 A94BFF6245 for ; Thu, 29 Jun 2017 18:43:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A94BFF6245 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A94BFF6245 Received: from thh440s.redhat.com (ovpn-116-90.ams2.redhat.com [10.36.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A35B5C46E; Thu, 29 Jun 2017 18:43:12 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini Cc: David Hildenbrand , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Laurent Vivier , Drew Jones Subject: [kvm-unit-tests v2 PATCH 2/3] Replace -Wextra with a saner list of warning flags Date: Thu, 29 Jun 2017 20:42:52 +0200 Message-Id: <1498761773-11164-3-git-send-email-thuth@redhat.com> In-Reply-To: <1498761773-11164-1-git-send-email-thuth@redhat.com> References: <1498761773-11164-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 29 Jun 2017 18:43:14 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using -Wextra together with -Werror is troublesome - various versions of GCC produce suspicious or even wrong warnings with -Wextra which then become fatal errors with -Werror. For example, the current state of the kvm-unit-tests does not compile anymore with GCC 4.8.1 for s390x due to an inadequate -Wmissing-field-initializers warning. That's annoying for users who just would like to compile the kvm-unit-tests and cumbersome for the developers who have to work around these problems in the source code. So let's replace -Wextra by a saner lists of warning flags that are normally enabled by -Wextra. Since they apparently can be used for building x86, too, the flags are now also applied to the global CFLAGS instead of specifying them for the single targets only. Signed-off-by: Thomas Huth --- v2: - Now that we've got COMMON_CFLAGS, the remaining flags can be added to the global CFLAGS, too - Removed -Wsign-compare Makefile | 10 +++++++--- arm/Makefile.common | 1 - powerpc/Makefile.common | 1 - s390x/Makefile | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3ef6ea7..f12b2df 100644 --- a/Makefile +++ b/Makefile @@ -50,9 +50,11 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -COMMON_CFLAGS += -g -COMMON_CFLAGS += $(autodepend-flags) -Wall -Wwrite-strings -Werror -frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer +COMMON_CFLAGS += -g $(autodepend-flags) +COMMON_CFLAGS += -Wall -Wwrite-strings -Wclobbered -Wempty-body -Wuninitialized +COMMON_CFLAGS += -Wtype-limits -Wignored-qualifiers -Wunused-but-set-parameter +COMMON_CFLAGS += -Werror + rame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "") fnostack_protector := $(call cc-option, -fno-stack-protector, "") fnostack_protector_all := $(call cc-option, -fno-stack-protector-all, "") @@ -67,6 +69,8 @@ COMMON_CFLAGS += $(if $(U32_LONG_FMT),-D__U32_LONG_FMT__,) COMMON_CFLAGS += $(fno_pic) $(no_pie) CFLAGS += $(COMMON_CFLAGS) +CFLAGS += -Wmissing-parameter-type -Wold-style-declaration -Woverride-init + CXXFLAGS += $(COMMON_CFLAGS) autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d diff --git a/arm/Makefile.common b/arm/Makefile.common index 03b497b..7e5f527 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -24,7 +24,6 @@ phys_base = $(LOADADDR) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -Wextra CFLAGS += -O2 CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -I lib diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index db5ba62..c4df2e9 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -19,7 +19,6 @@ all: directories $(TEST_DIR)/boot_rom.bin $(tests-all) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -Wextra CFLAGS += -O2 CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -I lib CFLAGS += -Wa,-mregnames diff --git a/s390x/Makefile b/s390x/Makefile index 470cbba..bc099da 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -7,7 +7,6 @@ test_cases: $(tests) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -Wextra CFLAGS += -I $(SRCDIR)/lib CFLAGS += -O2 CFLAGS += -march=z900