DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ionic: ignore missing field initializers warning
@ 2020-01-21  9:41 Ferruh Yigit
  2020-01-21  9:58 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2020-01-21  9:41 UTC (permalink / raw)
  To: Raslan Darawsheh; +Cc: dev

The compiler warning is:
   from .../drivers/net/ionic/ionic_dev.c:7:
.../drivers/net/ionic/ionic_if.h:202:5: note: ‘rsvd’ declared here
  u8 rsvd[62];
     ^

This has been observed with gcc 4.8.5, newer 9+ compiler are not giving
this warning.

Warning is to reminder to the user that there are some fields in the
struct not initialized with the default value.
But the C standard clarifies that in that case the field value will be
zero and code is aware of this behavior, so no initializing to a default
value is an intentional and it is safe to ignore this compiler warning.

Adding '-Wno-missing-field-initializers' compiler flag to disable the
warning.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/ionic/Makefile    | 2 ++
 drivers/net/ionic/meson.build | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile
index f74ac2d34..f218704cf 100644
--- a/drivers/net/ionic/Makefile
+++ b/drivers/net/ionic/Makefile
@@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_lif.c
 SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_main.c
 
+CFLAGS_ionic_dev.o += -Wno-missing-field-initializers
+
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build
index dee8a3608..06b776018 100644
--- a/drivers/net/ionic/meson.build
+++ b/drivers/net/ionic/meson.build
@@ -11,3 +11,12 @@ sources = files(
 	'ionic_main.c'
 )
 
+error_cflags = [
+  '-Wno-missing-field-initializers',
+]
+
+foreach flag: error_cflags
+        if cc.has_argument(flag)
+                c_args += flag
+        endif
+endforeach
-- 
2.24.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] net/ionic: ignore missing field initializers warning
  2020-01-21  9:41 [dpdk-dev] [PATCH] net/ionic: ignore missing field initializers warning Ferruh Yigit
@ 2020-01-21  9:58 ` Ferruh Yigit
  2020-01-21 10:01   ` Alfredo Cardigliano
  0 siblings, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2020-01-21  9:58 UTC (permalink / raw)
  To: Alfredo Cardigliano; +Cc: dev, Anoob Joseph, Raslan Darawsheh, Xueming Zhang

The compiler warning is:
   from .../drivers/net/ionic/ionic_dev.c:7:
.../drivers/net/ionic/ionic_if.h:202:5: note: ‘rsvd’ declared here
  u8 rsvd[62];
     ^

This has been observed with gcc 4.8.5, newer 9+ compiler are not giving
this warning.

Warning is a reminder to the user that there are some fields in the
struct not initialized with the default value.
But the C standard clarifies that in that case the field value will be
zero and code is aware of this behavior, so no initializing to a default
value is intentional and it is safe to ignore this compiler warning.

Adding '-Wno-missing-field-initializers' compiler flag to disable the
warning.

Reported-by: Anoob Joseph <anoobj@marvell.com>
Reported-by: Raslan Darawsheh <rasland@mellanox.com>
Reported-by: Xueming Zhang <xuemingx.zhang@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* add flag to ionic_lif.c too
---
 drivers/net/ionic/Makefile    | 3 +++
 drivers/net/ionic/meson.build | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile
index f74ac2d34..bfbe15e27 100644
--- a/drivers/net/ionic/Makefile
+++ b/drivers/net/ionic/Makefile
@@ -31,4 +31,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_ethdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_lif.c
 SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_main.c
 
+CFLAGS_ionic_dev.o += -Wno-missing-field-initializers
+CFLAGS_ionic_lif.o += -Wno-missing-field-initializers
+
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build
index dee8a3608..06b776018 100644
--- a/drivers/net/ionic/meson.build
+++ b/drivers/net/ionic/meson.build
@@ -11,3 +11,12 @@ sources = files(
 	'ionic_main.c'
 )
 
+error_cflags = [
+  '-Wno-missing-field-initializers',
+]
+
+foreach flag: error_cflags
+        if cc.has_argument(flag)
+                c_args += flag
+        endif
+endforeach
-- 
2.24.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ionic: ignore missing field initializers warning
  2020-01-21  9:58 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2020-01-21 10:01   ` Alfredo Cardigliano
  2020-01-21 13:39     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Alfredo Cardigliano @ 2020-01-21 10:01 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Anoob Joseph, Raslan Darawsheh, Xueming Zhang



> On 21 Jan 2020, at 10:58, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
> The compiler warning is:
>   from .../drivers/net/ionic/ionic_dev.c:7:
> .../drivers/net/ionic/ionic_if.h:202:5: note: ‘rsvd’ declared here
>  u8 rsvd[62];
>     ^
> 
> This has been observed with gcc 4.8.5, newer 9+ compiler are not giving
> this warning.
> 
> Warning is a reminder to the user that there are some fields in the
> struct not initialized with the default value.
> But the C standard clarifies that in that case the field value will be
> zero and code is aware of this behavior, so no initializing to a default
> value is intentional and it is safe to ignore this compiler warning.
> 
> Adding '-Wno-missing-field-initializers' compiler flag to disable the
> warning.
> 
> Reported-by: Anoob Joseph <anoobj@marvell.com>
> Reported-by: Raslan Darawsheh <rasland@mellanox.com>
> Reported-by: Xueming Zhang <xuemingx.zhang@intel.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> v2:
> * add flag to ionic_lif.c too
> ---
> drivers/net/ionic/Makefile    | 3 +++
> drivers/net/ionic/meson.build | 9 +++++++++
> 2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile
> index f74ac2d34..bfbe15e27 100644
> --- a/drivers/net/ionic/Makefile
> +++ b/drivers/net/ionic/Makefile
> @@ -31,4 +31,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_ethdev.c
> SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_lif.c
> SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_main.c
> 
> +CFLAGS_ionic_dev.o += -Wno-missing-field-initializers
> +CFLAGS_ionic_lif.o += -Wno-missing-field-initializers
> +
> include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build
> index dee8a3608..06b776018 100644
> --- a/drivers/net/ionic/meson.build
> +++ b/drivers/net/ionic/meson.build
> @@ -11,3 +11,12 @@ sources = files(
> 	'ionic_main.c'
> )
> 
> +error_cflags = [
> +  '-Wno-missing-field-initializers',
> +]
> +
> +foreach flag: error_cflags
> +        if cc.has_argument(flag)
> +                c_args += flag
> +        endif
> +endforeach
> -- 
> 2.24.1

This looks good to me.

Alfredo



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ionic: ignore missing field initializers warning
  2020-01-21 10:01   ` Alfredo Cardigliano
@ 2020-01-21 13:39     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2020-01-21 13:39 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: dev, Anoob Joseph, Raslan Darawsheh, Xueming Zhang, Alfredo Cardigliano

21/01/2020 11:01, Alfredo Cardigliano:
> 
> > On 21 Jan 2020, at 10:58, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > 
> > The compiler warning is:
> >   from .../drivers/net/ionic/ionic_dev.c:7:
> > .../drivers/net/ionic/ionic_if.h:202:5: note: ‘rsvd’ declared here
> >  u8 rsvd[62];
> >     ^
> > 
> > This has been observed with gcc 4.8.5, newer 9+ compiler are not giving
> > this warning.
> > 
> > Warning is a reminder to the user that there are some fields in the
> > struct not initialized with the default value.
> > But the C standard clarifies that in that case the field value will be
> > zero and code is aware of this behavior, so no initializing to a default
> > value is intentional and it is safe to ignore this compiler warning.
> > 
> > Adding '-Wno-missing-field-initializers' compiler flag to disable the
> > warning.
> > 
> > Reported-by: Anoob Joseph <anoobj@marvell.com>
> > Reported-by: Raslan Darawsheh <rasland@mellanox.com>
> > Reported-by: Xueming Zhang <xuemingx.zhang@intel.com>
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > ---
> > v2:
> > * add flag to ionic_lif.c too
> > ---
> > drivers/net/ionic/Makefile    | 3 +++
> > drivers/net/ionic/meson.build | 9 +++++++++
> > 2 files changed, 12 insertions(+)
[...]
> This looks good to me.

Applied, thanks




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-01-21 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21  9:41 [dpdk-dev] [PATCH] net/ionic: ignore missing field initializers warning Ferruh Yigit
2020-01-21  9:58 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2020-01-21 10:01   ` Alfredo Cardigliano
2020-01-21 13:39     ` Thomas Monjalon

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).