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 <conor.walsh@intel.com> --- config/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/config/meson.build b/config/meson.build index 258b01d068..15625c346a 100644 --- a/config/meson.build +++ b/config/meson.build @@ -192,6 +192,7 @@ warning_flags = [ # additional warnings in alphabetical order '-Wcast-qual', '-Wdeprecated', + '-Wformat', '-Wformat-nonliteral', '-Wformat-security', '-Wmissing-declarations', -- 2.25.1
12/11/2020 12:35, Conor Walsh:
> 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 <conor.walsh@intel.com>
Please could you provide (in a v2) more informations about the error
and why the fix is needed?
Tested-by: Chen, LingliX <linglix.chen@intel.com>
Regards,
Chen, LingliX
> -----Original Message-----
> From: Walsh, Conor
> Sent: Thursday, November 12, 2020 7:36 PM
> To: Richardson, Bruce <bruce.richardson@intel.com>
> Cc: dev@dpdk.org; Chen, LingliX <linglix.chen@intel.com>; Walsh, Conor
> <conor.walsh@intel.com>
> Subject: [PATCH v1] 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
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> ---
> config/meson.build | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/config/meson.build b/config/meson.build index
> 258b01d068..15625c346a 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -192,6 +192,7 @@ warning_flags = [
> # additional warnings in alphabetical order
> '-Wcast-qual',
> '-Wdeprecated',
> + '-Wformat',
> '-Wformat-nonliteral',
> '-Wformat-security',
> '-Wmissing-declarations',
> --
> 2.25.1
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
> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday 12 November 2020 18:47
> To: Walsh, Conor <conor.walsh@intel.com>
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; dev@dpdk.org; Chen,
> LingliX <linglix.chen@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v1] build: add Wformat to fix gcc compile
> error
>
> 12/11/2020 12:35, Conor Walsh:
> > 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 <conor.walsh@intel.com>
>
> Please could you provide (in a v2) more informations about the error
> and why the fix is needed?
>
>
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 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(-) -- 2.25.1
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(-) 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 -- 2.25.1
&device requires the %u format specifer not the %d specifier, as &device is unsigned. Fixes: a46bbb57605b ("net/bnxt: update multi device design") Cc: michael.wildt@broadcom.com Signed-off-by: Conor Walsh <conor.walsh@intel.com> --- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 0f49a00256..24d49096a7 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -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
On Wed, 2020-11-18 at 18:11 +0000, Conor Walsh wrote:
> 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
>
> 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(-)
Looks good to me, but it should be cc'ed to stable as well I think
--
Kind regards,
Luca Boccassi
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 stable@dpdk.org 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(-) -- 2.25.1
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(-) 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 -- 2.25.1
&device requires the %u format specifer not the %d specifier, as &device is unsigned. Fixes: a46bbb57605b ("net/bnxt: update multi device design") Cc: michael.wildt@broadcom.com Signed-off-by: Conor Walsh <conor.walsh@intel.com> --- drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 0f49a00256..24d49096a7 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -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
Thank you for your feedback Luca,
I pushed a v3 that now has stable cc'ed.
/Conor
> From: Luca Boccassi <bluca@debian.org>
> Sent: Wednesday 18 November 2020 18:38
> To: Walsh, Conor <conor.walsh@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; ajit.khaparde@broadcom.com;
> somnath.kotur@broadcom.com; stuart.schacher@broadcom.com;
> venkatkumar.duvvuru@broadcom.com; michael.wildt@broadcom.com
> Cc: dev@dpdk.org; Chen, LingliX <linglix.chen@intel.com>;
> thomas@monjalon.net
> Subject: Re: [dpdk-dev] [PATCH v2 0/2] build: add Wformat to fix gcc compile
> warnings and format fixes
>
> On Wed, 2020-11-18 at 18:11 +0000, Conor Walsh wrote:
> > 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
> >
> > 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(-)
>
> Looks good to me, but it should be cc'ed to stable as well I think
>
> --
> Kind regards,
> Luca Boccassi
On Thu, Nov 19, 2020 at 2:17 AM Conor Walsh <conor.walsh@intel.com> wrote: > > &device requires the %u format specifer not the %d specifier, as > &device is unsigned. > > Fixes: a46bbb57605b ("net/bnxt: update multi device design") > Cc: michael.wildt@broadcom.com > > Signed-off-by: Conor Walsh <conor.walsh@intel.com> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com> > --- > drivers/net/bnxt/tf_core/tf_core.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c > index 0f49a00256..24d49096a7 100644 > --- a/drivers/net/bnxt/tf_core/tf_core.c > +++ b/drivers/net/bnxt/tf_core/tf_core.c > @@ -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 >
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
19/11/2020 11:16, 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.
>
> ---
>
> v3: add stable@dpdk.org to cc list following list feedback
The Cc: stable@dpdk.org must be part of the commit log.
Please at other patches (and contributors guidelines) for inspiration.
Series applied, thanks.