DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH] build: remove duplicate checks for cflags
Date: Thu, 19 Jul 2018 15:22:06 +0100	[thread overview]
Message-ID: <20180719142206.1478-1-bruce.richardson@intel.com> (raw)

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 <bruce.richardson@intel.com>
---
 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
 
-- 
2.17.1

             reply	other threads:[~2018-07-19 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 14:22 Bruce Richardson [this message]
2018-07-26  8:10 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180719142206.1478-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).