fix warnings with gcc 9 on Fedora 30
cover fix warnings with gcc 9 on Fedora 30
This set of changes fixes warnings seen when compiling DPDK on Fedora 30. In most cases these warnings appear to be false positives, which means we have the option to just disable the warning. Because the changes required to the code to silence the warnings are fairly small I've chosen in all cases to change the code rather than disable the warnings, but I'm open to doing the opposite if it's felt it's a better solution. [One thing I didn't like about disabling the warnings is that the disabling flags are not supported by clang, so adding them involves compiler checks :-(]
NOTE: this set does not cover all warnings with GCC9, but it does cover those seen when building with meson. There is still one warning disable flag needed when building with make, which will need a follow-on set to fix.
Bruce Richardson (4):
net/ixgbe: fix warning with GCC 9 on Fedora 30 bus/fslmc: fix printf of null pointer raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30 raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
drivers/bus/fslmc/fslmc_bus.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 2 ++ drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 5 +++++ 4 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/4 net/ixgbe: fix warning with GCC 9 on Fedora 30
Compiling on Fedora 30, we get the following warning, causing build failure when Werror flag is set:
../drivers/net/ixgbe/ixgbe_rxtx.c:2141:14: warning: ‘nmb’ may be used uninitialized in this function [-Wmaybe-uninitialized]
2141 | rxe->mbuf = nmb;
| ~~~~~~~~~~^~~~~Initializing the value to "NULL" fixes the issue.
--- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ixgbe/ixgbe_rxtx.c +1 -1
@@ -2029,7 +2029,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,struct ixgbe_rx_entry *next_rxe =NULL ;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;union ixgbe_adv_rx_desc rxd;uint16_t data_len;uint16_t next_id;
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH 1/4] net/ixgbe: fix warning with GCC 9 on Fedora 30
Quoted 33 lines · Bruce Richardson
Compiling on Fedora 30, we get the following warning, causing build failure when Werror flag is set:
../drivers/net/ixgbe/ixgbe_rxtx.c:2141:14: warning: ‘nmb’ may be used uninitialized in this function [-Wmaybe-uninitialized]2141 | rxe->mbuf = nmb; | ~~~~~~~~~~^~~~~Initializing the value to "NULL" fixes the issue.
Fixes 8eecb3295aed ("ixgbe: add LRO support")Signed-off-by Bruce Richardson <[email protected]>--- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ixgbe/ixgbe_rxtx.c +1
-1@@ -2029,7 +2029,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, struct ixgbe_rx_entry *next_rxe = NULL;struct rte_mbuf *first_seg;struct rte_mbuf *rxm; -struct rte_mbuf *nmb; +struct rte_mbuf *nmb =NULL ;union ixgbe_adv_rx_desc rxd;uint16_t data_len;uint16_t next_id;
Quoted 4 lines
--
2.21.0
Signature · 1 line
David Marchand
PATCH 2/4 bus/fslmc: fix printf of null pointer
In reply to Bruce RichardsonPrinting a null pointer with %s is flagged as a warning by GCC 9, and should not be done. Replace the %s with the word "null" itself.
--- drivers/bus/fslmc/fslmc_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/fslmc/fslmc_bus.c +1 -1
@@ -197,7 +197,7 @@ scan_one_fslmc_device(char *dev_name) t_ptr =strtok (NULL ,"." );if (!t_ptr) { -DPAA2_BUS_ERR ("Incorrect device string observed (%s)" , t_ptr); +DPAA2_BUS_ERR ("Incorrect device string observed (null)" ); goto cleanup; }
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH 2/4] bus/fslmc: fix printf of null pointer
Quoted 16 lines · Bruce Richardson
Printing a null pointer with %s is flagged as a warning by GCC 9, and should not be done. Replace the %s with the word "null" itself.
Fixes 828d51d8fc3e ("bus/fslmc: refactor scan and probe functions")Signed-off-by Bruce Richardson <[email protected]>--- drivers/bus/fslmc/fslmc_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/bus/fslmc/fslmc_bus.c +0
-0
drivers/bus/fslmc/fslmc_bus.c scan_one_fslmc_device(char *dev_name) · line 202
Quoted 7 lines
drivers/bus/fslmc/fslmc_bus.c +1
-1@@ -197,7 +197,7 @@ scan_one_fslmc_device(char *dev_name) t_ptr =strtok (NULL ,"." );if (!t_ptr) { -DPAA2_BUS_ERR ("Incorrect device string observed (%s)" , t_ptr); +DPAA2_BUS_ERR ("Incorrect device string observed (null)" );
I'd rather print dev_name here, since t_ptr == NULL means that dev_name format is incorrect.
Signature · 1 line
David Marchand
PATCH 3/4 raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30
In reply to Bruce RichardsonGCC9 gives warnings if the parameter passed to printf for "%s" could be NULL, so we need to add checks in some cases to ensure that is not the case.
--- drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/raw/skeleton_rawdev/skeleton_rawdev.c +5 -0
@@ -705,6 +705,9 @@ skeleton_rawdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -EINVAL ; +/* More than one instance is not supported */ if (skeldev_init_once) { SKELETON_PMD_ERR("Multiple instance not supported for %s",
@@ -740,6 +743,8 @@ skeleton_rawdev_remove(struct rte_vdev_device *vdev)int ret; name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -1 ;SKELETON_PMD_INFO ("Closing %s on NUMA node %d" , name,rte_socket_id ());
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH 3/4] raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30
Quoted 38 lines · Bruce Richardson
GCC9 gives warnings if the parameter passed to printf for "%s" could be NULL, so we need to add checks in some cases to ensure that is not the case.
Fixes 61c592a8d035 ("raw/skeleton: introduce skeleton rawdev driver")Signed-off-by Bruce Richardson <[email protected]>--- drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/raw/skeleton_rawdev/skeleton_rawdev.c +5
-1@@ -705,6 +705,9 @@ skeleton_rawdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -EINVAL ; +/* More than one instance is not supported */ if (skeldev_init_once) { SKELETON_PMD_ERR("Multiple instance not supported for %s",@@ -740,6 +743,8 @@ skeleton_rawdev_remove(struct rte_vdev_device *vdev)int ret; name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -1 ;SKELETON_PMD_INFO ("Closing %s on NUMA node %d" , name,rte_socket_id ()); --
Quoted 2 lines
2.21.0
Signature · 1 line
David Marchand
PATCH 4/4 raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
In reply to Bruce RichardsonGCC9 gives warnings if the parameter passed to printf for "%s" could be NULL, so we need to add checks in some cases to ensure that is not the case.
--- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +2 -0
@@ -270,6 +270,8 @@ dpaa2_cmdif_remove(struct rte_vdev_device *vdev)int ret; name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -1 ;DPAA2_CMDIF_INFO ("Closing %s on NUMA node %d" , name,rte_socket_id ());
Signature · 1 line
2.21.0
Re: [dpdk-dev] [PATCH 4/4] raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
Quoted 29 lines · Bruce Richardson
GCC9 gives warnings if the parameter passed to printf for "%s" could be NULL, so we need to add checks in some cases to ensure that is not the case.
Fixes 3298fa4853b8 ("raw/dpaa2_cmdif: introduce DPAA2 command interfacedriver")
Cc: [email protected]Signed-off-by Bruce Richardson <[email protected]>--- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 2 ++ 1 file changed, 2 insertions(+)drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +2
-1@@ -270,6 +270,8 @@ dpaa2_cmdif_remove(struct rte_vdev_device *vdev)int ret; name =rte_vdev_device_name (vdev); +if (name ==NULL ) +return -1 ;DPAA2_CMDIF_INFO ("Closing %s on NUMA node %d" , name,rte_socket_id ()); --
Quoted 3 lines
2.21.0
Signature · 1 line
David Marchand
Thomas Monjalon
Applied01/05/2019 21:50, Bruce Richardson:
Quoted 14 lines
This set of changes fixes warnings seen when compiling DPDK on Fedora 30. In most cases these warnings appear to be false positives, which means we have the option to just disable the warning. Because the changes required to the code to silence the warnings are fairly small I've chosen in all cases to change the code rather than disable the warnings, but I'm open to doing the opposite if it's felt it's a better solution. [One thing I didn't like about disabling the warnings is that the disabling flags are not supported by clang, so adding them involves compiler checks :-(]
NOTE: this set does not cover all warnings with GCC9, but it does cover those seen when building with meson. There is still one warning disable flag needed when building with make, which will need a follow-on set to fix.
Quoted 5 lines
Bruce Richardson (4):
net/ixgbe: fix warning with GCC 9 on Fedora 30 bus/fslmc: fix printf of null pointer raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30 raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
Applied, thanks
Quoted 25 lines · Thomas Monjalon
01/05/2019 21:50, Bruce Richardson:
Quoted 4 lines
This set of changes fixes warnings seen when compiling DPDK on Fedora 30. In most cases these warnings appear to be false positives, which means we have the option to just disable the warning. Because the changes required to the code to silence the warnings are fairly small I've chosen in all
cases
Quoted 1 line
to change the code rather than disable the warnings, but I'm open to
doing
Quoted 1 line
the opposite if it's felt it's a better solution. [One thing I didn't
like
Quoted 1 line
about disabling the warnings is that the disabling flags are not
supported
Quoted 7 lines
by clang, so adding them involves compiler checks :-(]
NOTE: this set does not cover all warnings with GCC9, but it does cover those seen when building with meson. There is still one warning disable flag needed when building with make, which will need a follow-on set to fix.
Quoted 5 lines
Bruce Richardson (4):
net/ixgbe: fix warning with GCC 9 on Fedora 30 bus/fslmc: fix printf of null pointer raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30 raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
Quoted 5 lines
Applied, thanks
I had a comment on patch 2, and the bigger problem is -Waddress-of-packed-member.
The quicker solution for now is to downgrade it to warning only so that we can fix the parts later rather than globally disable it.
Signature · 1 line
David Marchand
Quoted 36 lines · David Marchand
On Thu, May 2, 2019 at 2:19 PM Thomas Monjalon <[1][email protected]> wrote:
01/05/2019 21:50, Bruce Richardson:
> This set of changes fixes warnings seen when compiling DPDK on Fedora 30.
> In most cases these warnings appear to be false positives, which means we
> have the option to just disable the warning. Because the changes required
> to the code to silence the warnings are fairly small I've chosen in all cases
> to change the code rather than disable the warnings, but I'm open to doing
> the opposite if it's felt it's a better solution. [One thing I didn't like
> about disabling the warnings is that the disabling flags are not supported
> by clang, so adding them involves compiler checks :-(] >
> NOTE: this set does not cover all warnings with GCC9, but it does cover
> those seen when building with meson. There is still one warning disable
> flag needed when building with make, which will need a follow-on set to
> fix.
>
> Bruce Richardson (4):
> net/ixgbe: fix warning with GCC 9 on Fedora 30
> bus/fslmc: fix printf of null pointer
> raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30
> raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
Cc: [2][email protected]
Applied, thanks
Quoted 5 lines
I had a comment on patch 2, and the bigger problem is -Waddress-of-packed-member.
The quicker solution for now is to downgrade it to warning only so that we can fix the parts later rather than globally disable it. --
Well, it is already a warning, it's just that with make we build by default with -Werror when building from git.
Also, that particular warning is already disabled for clang compilation, so extending that to being disabled for gcc seems fine for a fix for this release.
/Bruce
Quoted 38 lines · Bruce Richardson
Quoted 1 line · David Marchand
On Thu, May 2, 2019 at 2:19 PM Thomas Monjalon <[1]
Quoted 35 lines
wrote:
01/05/2019 21:50, Bruce Richardson:
> This set of changes fixes warnings seen when compiling DPDK on Fedora 30.
> In most cases these warnings appear to be false positives, which means we
> have the option to just disable the warning. Because the changes required
> to the code to silence the warnings are fairly small I've chosen in all cases
> to change the code rather than disable the warnings, but I'm open to doing
> the opposite if it's felt it's a better solution. [One thing I didn't like
> about disabling the warnings is that the disabling flags are not supported
> by clang, so adding them involves compiler checks :-(] >
> NOTE: this set does not cover all warnings with GCC9, but it does cover
> those seen when building with meson. There is still one warning disable
> flag needed when building with make, which will need a follow-on set to
> fix.
>
> Bruce Richardson (4):
> net/ixgbe: fix warning with GCC 9 on Fedora 30
> bus/fslmc: fix printf of null pointer
> raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30
> raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
Cc: [2][email protected]
Applied, thanks
Quoted 9 lines
Quoted 3 lines
I had a comment on patch 2, and the bigger problem is -Waddress-of-packed-member.
The quicker solution for now is to downgrade it to warning only sothat
Quoted 2 lines
we can fix the parts later rather than globally disable it. --
Well, it is already a warning, it's just that with make we build by default with -Werror when building from git.
Err, why don't we have -Werror for meson ?
Also, that particular warning is already disabled for clang compilation, so
Quoted 3 lines
extending that to being disabled for gcc seems fine for a fix for this release.
Arf, indeed..
Signature · 1 line
David Marchand
Quoted 61 lines · David Marchand
On Thu, May 2, 2019 at 3:24 PM Bruce Richardson <[1][email protected]> wrote:
On Thu, May 02, 2019 at 02:32:41PM +0200, David Marchand wrote:
> On Thu, May 2, 2019 at 2:19 PM Thomas Monjalon
<[1][2][email protected]>
> wrote:
>
> 01/05/2019 21:50, Bruce Richardson:
> > This set of changes fixes warnings seen when compiling DPDK
on
> Fedora 30.
> > In most cases these warnings appear to be false positives,
which
> means we
> > have the option to just disable the warning. Because the
changes
> required
> > to the code to silence the warnings are fairly small I've
chosen
> in all cases
> > to change the code rather than disable the warnings, but
I'm open
> to doing
> > the opposite if it's felt it's a better solution. [One
thing I
> didn't like
> > about disabling the warnings is that the disabling flags
are not
> supported
> > by clang, so adding them involves compiler checks :-(]
> >
> > NOTE: this set does not cover all warnings with GCC9, but
it does
> cover
> > those seen when building with meson. There is still one
warning
> disable
> > flag needed when building with make, which will need a
follow-on
> set to
> > fix.
> >
> > Bruce Richardson (4):
> > net/ixgbe: fix warning with GCC 9 on Fedora 30
> > bus/fslmc: fix printf of null pointer
> > raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30
> > raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
> Cc: [2][3][email protected]
> Applied, thanks
>
> I had a comment on patch 2, and the bigger problem is
> -Waddress-of-packed-member.
> The quicker solution for now is to downgrade it to warning only
so that
> we can fix the parts later rather than globally disable it.
> --
Well, it is already a warning, it's just that with make we build by default
with -Werror when building from git.
Quoted 2 lines
Err, why don't we have -Werror for meson ?
Because it's generally not a good idea to use -Werror by default. However, the test-meson-build script (which we should all be using for test compilation before upstreaming) sets it for all builds.
/Bruce
Quoted 62 lines · Bruce Richardson
Quoted 61 lines · David Marchand
On Thu, May 2, 2019 at 3:24 PM Bruce Richardson <[1][email protected]> wrote:
On Thu, May 02, 2019 at 02:32:41PM +0200, David Marchand wrote:
> On Thu, May 2, 2019 at 2:19 PM Thomas Monjalon
<[1][2][email protected]>
> wrote:
>
> 01/05/2019 21:50, Bruce Richardson:
> > This set of changes fixes warnings seen when compiling DPDK
on
> Fedora 30.
> > In most cases these warnings appear to be false positives,
which
> means we
> > have the option to just disable the warning. Because the
changes
> required
> > to the code to silence the warnings are fairly small I've
chosen
> in all cases
> > to change the code rather than disable the warnings, but
I'm open
> to doing
> > the opposite if it's felt it's a better solution. [One
thing I
> didn't like
> > about disabling the warnings is that the disabling flags
are not
> supported
> > by clang, so adding them involves compiler checks :-(]
> >
> > NOTE: this set does not cover all warnings with GCC9, but
it does
> cover
> > those seen when building with meson. There is still one
warning
> disable
> > flag needed when building with make, which will need a
follow-on
> set to
> > fix.
> >
> > Bruce Richardson (4):
> > net/ixgbe: fix warning with GCC 9 on Fedora 30
> > bus/fslmc: fix printf of null pointer
> > raw/skeleton_rawdev: fix warnings with GCC 9 on Fedora 30
> > raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora 30
> Cc: [2][3][email protected]
> Applied, thanks
>
> I had a comment on patch 2, and the bigger problem is
> -Waddress-of-packed-member.
> The quicker solution for now is to downgrade it to warning only
so that
> we can fix the parts later rather than globally disable it.
> --
Well, it is already a warning, it's just that with make we build by default
with -Werror when building from git.
Quoted 7 lines
Quoted 2 lines
Err, why don't we have -Werror for meson ?
Because it's generally not a good idea to use -Werror by default. However, the test-meson-build script (which we should all be using for test compilation before upstreaming) sets it for all builds.
Yes ok, so that old releases still build on newer toolchains. As for the test-meson-builds.sh and test-build.sh scripts, they are still widely unknown except by maintainers.
But at least, the ci build script would catch the errors, since it configures with "meson build --werror -Dexamples=all $OPTS"
Signature · 1 line
David Marchand
Quoted 89 lines · David Marchand
On Thu, May 2, 2019 at 3:46 PM Bruce Richardson <[1][email protected]> wrote:
On Thu, May 02, 2019 at 03:32:20PM +0200, David Marchand wrote:
> On Thu, May 2, 2019 at 3:24 PM Bruce Richardson
> <[1][2][email protected]> wrote:
>
> On Thu, May 02, 2019 at 02:32:41PM +0200, David Marchand
wrote:
> > On Thu, May 2, 2019 at 2:19 PM Thomas Monjalon
> <[1][2][3][email protected]>
> > wrote:
> >
> > 01/05/2019 21:50, Bruce Richardson:
> > > This set of changes fixes warnings seen when
compiling DPDK
> on
> > Fedora 30.
> > > In most cases these warnings appear to be false
positives,
> which
> > means we
> > > have the option to just disable the warning. Because
the
> changes
> > required
> > > to the code to silence the warnings are fairly small
I've
> chosen
> > in all cases
> > > to change the code rather than disable the warnings,
but
> I'm open
> > to doing
> > > the opposite if it's felt it's a better solution.
[One
> thing I
> > didn't like
> > > about disabling the warnings is that the disabling
flags
> are not
> > supported
> > > by clang, so adding them involves compiler checks
:-(]
> > >
> > > NOTE: this set does not cover all warnings with
GCC9, but
> it does
> > cover
> > > those seen when building with meson. There is still
one
> warning
> > disable
> > > flag needed when building with make, which will need
a
> follow-on
> > set to
> > > fix.
> > >
> > > Bruce Richardson (4):
> > > net/ixgbe: fix warning with GCC 9 on Fedora 30
> > > bus/fslmc: fix printf of null pointer
> > > raw/skeleton_rawdev: fix warnings with GCC 9 on
Fedora 30
> > > raw/dpaa2_cmdif: fix warnings with GCC 9 on Fedora
30
> > Cc: [2][3][4][email protected]
> > Applied, thanks
> >
> > I had a comment on patch 2, and the bigger problem is
> > -Waddress-of-packed-member.
> > The quicker solution for now is to downgrade it to
warning only
> so that
> > we can fix the parts later rather than globally disable
it.
> > --
> Well, it is already a warning, it's just that with make we
build by
> default
> with -Werror when building from git.
>
> Err, why don't we have -Werror for meson ?
>
Because it's generally not a good idea to use -Werror by default. However,
the test-meson-build script (which we should all be using for test compilation before upstreaming) sets it for all builds.
Quoted 6 lines
Yes ok, so that old releases still build on newer toolchains. As for the
test-meson-builds.shandtest-build.shscripts, they are still widely unknown except by maintainers.
But at least, the ci build script would catch the errors, since it configures with "meson build --werror -Dexamples=all $OPTS" --
Yep, that's the idea. So long as it's easy enough for maintainers and CI to use werror, we should be covered.