From patchwork Thu Feb 12 15:18:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Panu Matilainen X-Patchwork-Id: 3231 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 77A38ADF6; Thu, 12 Feb 2015 16:18:28 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 6FC099A8F for ; Thu, 12 Feb 2015 16:18:26 +0100 (CET) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1CFIPqt004196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 12 Feb 2015 10:18:25 -0500 Received: from localhost.localdomain.com (vpn1-5-97.ams2.redhat.com [10.36.5.97]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1CFIOSg032037 for ; Thu, 12 Feb 2015 10:18:24 -0500 From: Panu Matilainen To: dev@dpdk.org Date: Thu, 12 Feb 2015 17:18:20 +0200 Message-Id: <65cbd71d3b5b45f469a2fe67fe8b0def4bddebbd.1423754231.git.pmatilai@redhat.com> In-Reply-To: <54DCB16F.7080104@redhat.com> References: <54DCB16F.7080104@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Subject: [dpdk-dev] [PATCH v2] mk: Only default to -Werror when building from git checkout X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add RTE_DEVEL_BUILD make-variable which can be used to do things differently when doing development vs building a release, autodetected from source root .git presence and overridable via commandline. Use it to only enable -Werror compiler flag when building a git checkout: Failing build on warnings is a useful developer tool but its bad for release tarballs which can and do get built with newer compilers than what was used/available during development. Compilers routinely add new warnings so code which built silently with cc X might no longer do so with X+1. This doesn't make the existing code any more buggier and failing the build in this case does not help not help improve code quality of an already released version either. --- mk/rte.vars.mk | 4 ++++ mk/toolchain/clang/rte.vars.mk | 6 +++++- mk/toolchain/gcc/rte.vars.mk | 6 +++++- mk/toolchain/icc/rte.vars.mk | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/mk/rte.vars.mk b/mk/rte.vars.mk index d5b36be..a4ad367 100644 --- a/mk/rte.vars.mk +++ b/mk/rte.vars.mk @@ -71,6 +71,10 @@ ifneq ($(BUILDING_RTE_SDK),) ifeq ($(RTE_BUILD_COMBINE_LIBS),) RTE_BUILD_COMBINE_LIBS := n endif + # see if we're building from git + ifneq ($(wildcard $(RTE_SDK)/.git),) + RTE_DEVEL_BUILD := y + endif endif RTE_LIBNAME := $(CONFIG_RTE_LIBNAME:"%"=%) diff --git a/mk/toolchain/clang/rte.vars.mk b/mk/toolchain/clang/rte.vars.mk index 40cb389..01b1860 100644 --- a/mk/toolchain/clang/rte.vars.mk +++ b/mk/toolchain/clang/rte.vars.mk @@ -63,12 +63,16 @@ TOOLCHAIN_ASFLAGS = TOOLCHAIN_CFLAGS = TOOLCHAIN_LDFLAGS = -WERROR_FLAGS := -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes +WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith WERROR_FLAGS += -Wnested-externs -Wcast-qual WERROR_FLAGS += -Wformat-nonliteral -Wformat-security WERROR_FLAGS += -Wundef -Wwrite-strings +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror +endif + # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index 88f235c..fc3a642 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -71,12 +71,16 @@ ifeq (,$(findstring -O0,$(EXTRA_CFLAGS))) endif endif -WERROR_FLAGS := -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes +WERROR_FLAGS := -W -Wall -Wstrict-prototypes -Wmissing-prototypes WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual WERROR_FLAGS += -Wformat-nonliteral -Wformat-security WERROR_FLAGS += -Wundef -Wwrite-strings +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror +endif + # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk diff --git a/mk/toolchain/icc/rte.vars.mk b/mk/toolchain/icc/rte.vars.mk index e39d710..0850719 100644 --- a/mk/toolchain/icc/rte.vars.mk +++ b/mk/toolchain/icc/rte.vars.mk @@ -69,9 +69,13 @@ TOOLCHAIN_ASFLAGS = # error #13368: loop was not vectorized with "vector always assert" # error #15527: loop was not vectorized: function call to fprintf cannot be vectorize # was declared "deprecated" -WERROR_FLAGS := -Wall -Werror-all -w2 -diag-disable 271 -diag-warning 1478 +WERROR_FLAGS := -Wall -w2 -diag-disable 271 -diag-warning 1478 WERROR_FLAGS += -diag-disable 13368 -diag-disable 15527 +ifeq ($(RTE_DEVEL_BUILD),y) +WERROR_FLAGS += -Werror-all +endif + # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk # disable max-inline params boundaries for ICC 15 compiler