build: add Wformat to fix gcc compile error
Subsystems (2)
PATCH 1/1 build: add Wformat to fix gcc compile error
On some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified. This patch adds Wformat to config/meson.build
--- config/meson.build | 1 + 1 file changed, 1 insertion(+)
config/meson.build +1 -0
@@ -192,6 +192,7 @@ warning_flags = [ # additional warnings in alphabetical order '-Wcast-qual', '-Wdeprecated', + '-Wformat', '-Wformat-nonliteral', '-Wformat-security', '-Wmissing-declarations',
Signature · 1 line
2.25.1
12/11/2020 12:35, Conor Walsh:
Quoted 5 lines
On some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified. This patch adds Wformat to config/meson.build
Signed-off-by Conor Walsh <[email protected]>
Please could you provide (in a v2) more informations about the error and why the fix is needed?
Thanks for your reply Thomas, that's no problem.
I will expand the explanation for this patch when I push a v2, v2 will hopefully also address the issues it caused with the icc build.
/Conor
Quoted 20 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday 12 November 2020 18:47
To: Walsh, Conor <[email protected]>
Cc: Richardson, Bruce <[email protected]>; [email protected]; Chen, LingliX <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v1] build: add Wformat to fix gcc compile error12/11/2020 12:35, Conor Walsh:
Quoted 5 lines
On some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified. This patch adds Wformat to config/meson.build
Signed-off-by Conor Walsh <[email protected]>Please could you provide (in a v2) more informations about the error and why the fix is needed?
Regards,
Chen, LingliX
Quoted 31 lines
-----Original Message-----
From: Walsh, Conor
Sent: Thursday, November 12, 2020 7:36 PM
To: Richardson, Bruce <[email protected]>
Cc: [email protected]; Chen, LingliX <[email protected]>; Walsh, Conor <[email protected]>
Subject: [PATCH v1] build: add Wformat to fix gcc compile errorOn some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified. This patch adds Wformat to config/meson.build
Signed-off-by Conor Walsh <[email protected]>--- config/meson.build | 1 + 1 file changed, 1 insertion(+)config/meson.build index renamed from config/meson.build +0
-0
258b01d068..15625c346a100644config/meson.build +1
-1@@ -192,6 +192,7 @@ warning_flags = [ # additional warnings in alphabetical order '-Wcast-qual', '-Wdeprecated', + '-Wformat', '-Wformat-nonliteral', '-Wformat-security', '-Wmissing-declarations', --2.25.1
v2 cover build: add Wformat to fix gcc compile warnings and format fixes
In reply to Conor WalshOn some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified this causes a compile warning on these systems. This patchset adds Wformat to config/meson.build and fixes some format issues that this exposed.
---
v2:
- expand explaination of patches
- suppress false postives in icc
- add fixes for format issues
Conor Walsh (2):
build: fix gcc compile warnings by adding wformat net/bnxt: fix format characters for unsigned values
config/meson.build | 3 ++- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/2 build: fix gcc compile warnings by adding wformat
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.
--- config/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
config/meson.build +2 -1
@@ -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
Signature · 1 line
2.25.1
PATCH v2 2/2 net/bnxt: fix format characters for unsigned values
In reply to Conor Walsh&device requires the %u format specifer not the %d specifier, as &device is unsigned.
--- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +4 -4
@@ -44,7 +44,7 @@ tf_open_session(struct tf *tfp,/* Verify control channel and build the beginning of session_id */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,
@@ -57,7 +57,7 @@ tf_open_session(struct tf *tfp,/* Check parsing of bus/slot/device */ rc =sscanf (parms->ctrl_chan_name, -"%x:%x.%d" , +"%x:%x.%u" , &bus, &slot, &device);
@@ -102,7 +102,7 @@ tf_attach_session(struct tf *tfp,/* Verify control channel */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,
@@ -115,7 +115,7 @@ tf_attach_session(struct tf *tfp,/* Verify 'attach' channel */ rc = sscanf(parms->attach_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 0/2] build: add Wformat to fix gcc compile warnings and format fixes
In reply to Conor WalshQuoted 12 lines · Conor Walsh
On some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified this causes a compile warning on these systems. This patchset adds Wformat to config/meson.build and fixes some format issues that this exposed.
---
v2:
- expand explaination of patches
- suppress false postives in icc
- add fixes for format issues
Quoted 7 lines
Conor Walsh (2):
build: fix gcc compile warnings by adding wformat net/bnxt: fix format characters for unsigned valuesconfig/meson.build | 3 ++- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
Looks good to me, but it should be cc'ed to stable as well I think
Signature · 2 lines
Kind regards, Luca Boccassi
Re: [dpdk-dev] [PATCH v2 0/2] build: add Wformat to fix gcc compile warnings and format fixes
Thank you for your feedback Luca,
I pushed a v3 that now has stable cc'ed.
/Conor
Quoted 37 lines
From: Luca Boccassi <[email protected]>
Sent: Wednesday 18 November 2020 18:38
To: Walsh, Conor <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Chen, LingliX <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 0/2] build: add Wformat to fix gcc compile warnings and format fixesQuoted 12 lines · Conor Walsh
On some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified this causes a compile warning on these systems. This patchset adds Wformat to config/meson.build and fixes some format issues that this exposed.
---
v2:
- expand explaination of patches
- suppress false postives in icc
- add fixes for format issuesQuoted 7 lines
Conor Walsh (2):
build: fix gcc compile warnings by adding wformat net/bnxt: fix format characters for unsigned valuesconfig/meson.build | 3 ++- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-)Looks good to me, but it should be cc'ed to stable as well I think
--
Kind regards,
Luca Boccassi
v3 cover build: add Wformat to fix gcc compile warnings and format fixes
In reply to Conor WalshOn some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified this causes a compile warning on these systems. This patchset adds Wformat to config/meson.build and fixes some format issues that this exposed.
---
v3: add [email protected] to cc list following list feedback
v2:
- expand explaination of patches
- suppress false postives in icc
- add fixes for format issues
Conor Walsh (2):
build: fix gcc compile warnings by adding wformat net/bnxt: fix format characters for unsigned values
config/meson.build | 3 ++- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/2 build: fix gcc compile warnings by adding wformat
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.
--- config/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
config/meson.build +2 -1
@@ -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
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 1/2] build: fix gcc compile warnings by adding wformat
Regards,
Chen, LingliX
Quoted 10 lines
-----Original Message-----
From: Walsh, Conor
Sent: Thursday, November 19, 2020 6:17 PM
To: Richardson, Bruce <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Chen, LingliX <[email protected]>; [email protected]; Walsh, Conor <[email protected]>; Chen
Subject: [PATCH v3 1/2] build: fix gcc compile warnings by adding wformat
PATCH v3 2/2 net/bnxt: fix format characters for unsigned values
In reply to Conor Walsh&device requires the %u format specifer not the %d specifier, as &device is unsigned.
--- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/bnxt/tf_core/tf_core.c +4 -4
@@ -44,7 +44,7 @@ tf_open_session(struct tf *tfp,/* Verify control channel and build the beginning of session_id */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,
@@ -57,7 +57,7 @@ tf_open_session(struct tf *tfp,/* Check parsing of bus/slot/device */ rc =sscanf (parms->ctrl_chan_name, -"%x:%x.%d" , +"%x:%x.%u" , &bus, &slot, &device);
@@ -102,7 +102,7 @@ tf_attach_session(struct tf *tfp,/* Verify control channel */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,
@@ -115,7 +115,7 @@ tf_attach_session(struct tf *tfp,/* Verify 'attach' channel */ rc = sscanf(parms->attach_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v3 2/2] net/bnxt: fix format characters for unsigned values
Quoted 8 lines · Conor Walsh
&device requires the %u format specifer not the %d specifier, as &device is unsigned.
Fixes a46bbb57605b ("net/bnxt: update multi device design")Signed-off-by Conor Walsh <[email protected]>
Quoted 47 lines
--- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/bnxt/tf_core/tf_core.c +4
-5@@ -44,7 +44,7 @@ tf_open_session(struct tf *tfp,/* Verify control channel and build the beginning of session_id */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,@@ -57,7 +57,7 @@ tf_open_session(struct tf *tfp,/* Check parsing of bus/slot/device */ rc =sscanf (parms->ctrl_chan_name, -"%x:%x.%d" , +"%x:%x.%u" , &bus, &slot, &device);@@ -102,7 +102,7 @@ tf_attach_session(struct tf *tfp,/* Verify control channel */ rc = sscanf(parms->ctrl_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot,@@ -115,7 +115,7 @@ tf_attach_session(struct tf *tfp,/* Verify 'attach' channel */ rc = sscanf(parms->attach_chan_name, - "%x:%x:%x.%d", + "%x:%x:%x.%u", &domain, &bus, &slot, --2.25.1
Re: [dpdk-dev] [dpdk-stable] [PATCH v3 0/2] build: add Wformat to fix gcc compile warnings and format fixes
In reply to Conor Walsh19/11/2020 11:16, Conor Walsh:
Quoted 8 lines
On some systems Wformat-nonliteral and Wformat-security could not be checked without Wformat also being specified this causes a compile warning on these systems. This patchset adds Wformat to config/meson.build and fixes some format issues that this exposed.
---
v3: add [email protected] to cc list following list feedback
The Cc: [email protected] must be part of the commit log. Please at other patches (and contributors guidelines) for inspiration.
Series applied, thanks.