[v3,1/2] build: fix gcc compile warnings by adding wformat
diff mbox series

Message ID 20201119101700.3869583-2-conor.walsh@intel.com
State Accepted, archived
Delegated to: Ajit Khaparde
Headers show
Series
  • build: add Wformat to fix gcc compile warnings and format fixes
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Walsh, Conor Nov. 19, 2020, 10:16 a.m. UTC
On some CentOS/RHEL systems using gcc 8.3.1 to compile dpdk, gcc shows a
warning on every build step saying that -Wformat-nonliteral and
-Wformat-security warnings will be ignored unless -Wformat is
also specified as a compiler flag. When the build is run with -werror
the build will fail due to these warnings.

Exact warning returned:
cc1: error: -Wformat-nonliteral ignored without -Wformat
[-Werror=format-nonliteral]
cc1: error: -Wformat-security ignored without -Wformat
[-Werror=format-security]
cc1: all warnings being treated as errors

This patch adds the -Wformat flag to config/meson.build. The warning id
181 has also been suppressed in icc as icc was showing false positives
with -Wformat enabled.

Fixes: 524a0d5d66b9 ("build: enable extra warnings with meson")
Cc: bruce.richardson@intel.com

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Tested-by: Chen, LingliX <linglix.chen@intel.com>
---
 config/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Chen, LingliX Nov. 20, 2020, 7:23 a.m. UTC | #1
Tested-by:  Chen, LingliX <linglix.chen@intel.com>

Regards,
Chen, LingliX

> -----Original Message-----
> From: Walsh, Conor
> Sent: Thursday, November 19, 2020 6:17 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>;
> ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com;
> bluca@debian.org; stuart.schacher@broadcom.com;
> venkatkumar.duvvuru@broadcom.com; michael.wildt@broadcom.com
> Cc: dev@dpdk.org; stable@dpdk.org; Chen, LingliX <linglix.chen@intel.com>;
> thomas@monjalon.net; Walsh, Conor <conor.walsh@intel.com>; Chen
> Subject: [PATCH v3 1/2] build: fix gcc compile warnings by adding wformat

Patch
diff mbox series

diff --git a/config/meson.build b/config/meson.build
index a29693b883..c02802c18e 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -194,6 +194,7 @@  warning_flags = [
 	# additional warnings in alphabetical order
 	'-Wcast-qual',
 	'-Wdeprecated',
+	'-Wformat',
 	'-Wformat-nonliteral',
 	'-Wformat-security',
 	'-Wmissing-declarations',
@@ -220,7 +221,7 @@  if not dpdk_conf.get('RTE_ARCH_64')
 	warning_flags += '-Wno-pointer-to-int-cast'
 endif
 if cc.get_id() == 'intel'
-	warning_ids = [188, 2203, 2279, 2557, 3179, 3656]
+	warning_ids = [181, 188, 2203, 2279, 2557, 3179, 3656]
 	foreach i:warning_ids
 		warning_flags += '-diag-disable=@0@'.format(i)
 	endforeach