From patchwork Thu Jul 19 14:22:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 43203 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE97D4C94; Thu, 19 Jul 2018 16:22:21 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 8E3EE3572 for ; Thu, 19 Jul 2018 16:22:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2018 07:22:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,374,1526367600"; d="scan'208";a="56234947" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by fmsmga008.fm.intel.com with ESMTP; 19 Jul 2018 07:22:11 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Thu, 19 Jul 2018 15:22:06 +0100 Message-Id: <20180719142206.1478-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] build: remove duplicate checks for cflags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" There is no need to check for each library, driver and example whether certain cflags are supported. Instead of checking inside the loop, do so outside and reuse the value. Signed-off-by: Bruce Richardson --- drivers/meson.build | 9 +++++---- examples/meson.build | 9 +++++---- lib/meson.build | 10 +++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index 1737d86b8..82cc8ed49 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -11,6 +11,10 @@ driver_classes = ['common', 'event', # depends on common, bus, mempool and net. 'raw'] # depends on common, bus, mempool, net and event. +default_cflags = machine_args +if cc.has_argument('-Wno-format-truncation') + default_cflags += '-Wno-format-truncation' +endif foreach class:driver_classes drivers = [] std_deps = [] @@ -31,10 +35,7 @@ foreach class:driver_classes allow_experimental_apis = false sources = [] objs = [] - cflags = machine_args - if cc.has_argument('-Wno-format-truncation') - cflags += '-Wno-format-truncation' - endif + cflags = default_cflags includes = [include_directories(drv_path)] # set up internal deps. Drivers can append/override as necessary deps = std_deps diff --git a/examples/meson.build b/examples/meson.build index e6558875a..4ee7a1114 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -18,15 +18,16 @@ else examples = get_option('examples').split(',') allow_skips = false # error out if we can't build a requested app endif +default_cflags = machine_args +if cc.has_argument('-Wno-format-truncation') + default_cflags += '-Wno-format-truncation' +endif foreach example: examples name = example build = true sources = [] allow_experimental_apis = false - cflags = machine_args - if cc.has_argument('-Wno-format-truncation') - cflags += '-Wno-format-truncation' - endif + cflags = default_cflags ext_deps = [execinfo] includes = [include_directories(example)] diff --git a/lib/meson.build b/lib/meson.build index d88b0211e..1cc7e111f 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -26,6 +26,10 @@ libraries = [ 'compat', # just a header, used for versioning # flow_classify lib depends on pkt framework table lib 'flow_classify', 'bpf'] +default_cflags = machine_args +if cc.has_argument('-Wno-format-truncation') + default_cflags += '-Wno-format-truncation' +endif foreach l:libraries build = true name = l @@ -34,11 +38,7 @@ foreach l:libraries sources = [] headers = [] includes = [] - cflags = machine_args - if cc.has_argument('-Wno-format-truncation') - cflags += '-Wno-format-truncation' - endif - + cflags = default_cflags objs = [] # other object files to link against, used e.g. for # instruction-set optimized versions of code