[dpdk-dev] net/qede: fix gcc compiler option checks

Message ID 1477636677-18041-1-git-send-email-rasesh.mody@qlogic.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Rasesh Mody Oct. 28, 2016, 6:37 a.m. UTC
  From: Rasesh Mody <Rasesh.Mody@cavium.com>

Using GCC_VERSION to check gcc version and decide whether to include
that compiler option.

Fixes: ec94dbc57362 ("qede: add base driver")
Fixes: ecc7a5a27ffe ("net/qede/base: fix 32-bit build")

Signed-off-by: Rasesh Mody <Rasesh.Mody@cavium.com>
---
 drivers/net/qede/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger Oct. 28, 2016, 10:12 p.m. UTC | #1
On Thu, 27 Oct 2016 23:37:57 -0700
Rasesh Mody <rasesh.mody@qlogic.com> wrote:

> From: Rasesh Mody <Rasesh.Mody@cavium.com>
> 
> Using GCC_VERSION to check gcc version and decide whether to include
> that compiler option.
> 
> Fixes: ec94dbc57362 ("qede: add base driver")
> Fixes: ecc7a5a27ffe ("net/qede/base: fix 32-bit build")
> 
> Signed-off-by: Rasesh Mody <Rasesh.Mody@cavium.com>
> ---
>  drivers/net/qede/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
> index 39751e4..29b443d 100644
> --- a/drivers/net/qede/Makefile
> +++ b/drivers/net/qede/Makefile
> @@ -46,11 +46,11 @@ endif
>  endif
>  
>  ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
> -ifeq ($(shell gcc -Wno-unused-but-set-variable -Werror -E - < /dev/null > /dev/null 2>&1; echo $$?),0)
> +ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
>  CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
>  endif
>  CFLAGS_BASE_DRIVER += -Wno-missing-declarations
> -ifeq ($(shell gcc -Wno-maybe-uninitialized -Werror -E - < /dev/null > /dev/null 2>&1; echo $$?),0)
> +ifeq ($(shell test $(GCC_VERSION) -ge 46 && echo 1), 1)
>  CFLAGS_BASE_DRIVER += -Wno-maybe-uninitialized
>  endif
>  CFLAGS_BASE_DRIVER += -Wno-strict-prototypes

Does this mean that less compiler checking is done or more?
It seems lots of drivers make the excuse:
 "the base driver comes from another group and is known buggy but can't be fixed"
That doesn't reflect well on the quality of the DPDK.
  
Mody, Rasesh Oct. 28, 2016, 10:49 p.m. UTC | #2
Hi Stephen,

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Friday, October 28, 2016 3:12 PM
> 
> On Thu, 27 Oct 2016 23:37:57 -0700
> Rasesh Mody <rasesh.mody@qlogic.com> wrote:
> 
> > From: Rasesh Mody <Rasesh.Mody@cavium.com>
> >
> > Using GCC_VERSION to check gcc version and decide whether to include
> > that compiler option.
> >
> > Fixes: ec94dbc57362 ("qede: add base driver")
> > Fixes: ecc7a5a27ffe ("net/qede/base: fix 32-bit build")
> >
> > Signed-off-by: Rasesh Mody <Rasesh.Mody@cavium.com>
> > ---
> >  drivers/net/qede/Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
> > index 39751e4..29b443d 100644
> > --- a/drivers/net/qede/Makefile
> > +++ b/drivers/net/qede/Makefile
> > @@ -46,11 +46,11 @@ endif
> >  endif
> >
> >  ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
> > -ifeq ($(shell gcc -Wno-unused-but-set-variable -Werror -E - <
> > /dev/null > /dev/null 2>&1; echo $$?),0)
> > +ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
> >  CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable  endif
> > CFLAGS_BASE_DRIVER += -Wno-missing-declarations -ifeq ($(shell gcc
> > -Wno-maybe-uninitialized -Werror -E - < /dev/null > /dev/null 2>&1;
> > echo $$?),0)
> > +ifeq ($(shell test $(GCC_VERSION) -ge 46 && echo 1), 1)
> >  CFLAGS_BASE_DRIVER += -Wno-maybe-uninitialized  endif
> > CFLAGS_BASE_DRIVER += -Wno-strict-prototypes
> 
> Does this mean that less compiler checking is done or more?

With higher version of compilers more compiler checking is done, for older compilers less checking is done. As some of the older compiles do not have newly added checking capabilities. Testing with latest compilers ensures we do lot more checking.

Thanks!
-Rasesh

> It seems lots of drivers make the excuse:
>  "the base driver comes from another group and is known buggy but can't be
> fixed"
> That doesn't reflect well on the quality of the DPDK.
  
Thomas Monjalon Nov. 7, 2016, 7:54 p.m. UTC | #3
2016-10-28 22:49, Mody, Rasesh:
> > From: Stephen Hemminger
> > >  ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
> > > -ifeq ($(shell gcc -Wno-unused-but-set-variable -Werror -E - < /dev/null > /dev/null 2>&1; echo $$?),0)
> > > +ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
> > >  CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
> > >  endif
> > >  CFLAGS_BASE_DRIVER += -Wno-missing-declarations
> > > -ifeq ($(shell gcc -Wno-maybe-uninitialized -Werror -E - < /dev/null > /dev/null 2>&1; echo $$?),0)
> > > +ifeq ($(shell test $(GCC_VERSION) -ge 46 && echo 1), 1)
> > >  CFLAGS_BASE_DRIVER += -Wno-maybe-uninitialized
> > >  endif
> > 
> > Does this mean that less compiler checking is done or more?
> 
> With higher version of compilers more compiler checking is done, for older compilers less checking is done. As some of the older compiles do not have newly added checking capabilities. Testing with latest compilers ensures we do lot more checking.

It is basically less checking.
It disables some checks if the compiler support them because it would
make compilation failing.

Why would it fail? Because as other base drivers, the code is messy.

> > It seems lots of drivers make the excuse:
> >  "the base driver comes from another group and is known buggy but can't be
> >  fixed"
> > That doesn't reflect well on the quality of the DPDK.

You're right Stephen. It is an excuse which has been accepted in DPDK.
Should we be stricter?
  
Thomas Monjalon Nov. 7, 2016, 8:10 p.m. UTC | #4
2016-10-27 23:37, Rasesh Mody:
> From: Rasesh Mody <Rasesh.Mody@cavium.com>
> 
> Using GCC_VERSION to check gcc version and decide whether to include
> that compiler option.
> 
> Fixes: ec94dbc57362 ("qede: add base driver")

No need for the above line.
It is fixing the commit below (which fixes above one).

> Fixes: ecc7a5a27ffe ("net/qede/base: fix 32-bit build")
> 
> Signed-off-by: Rasesh Mody <Rasesh.Mody@cavium.com>

Applied, thanks
  

Patch

diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index 39751e4..29b443d 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -46,11 +46,11 @@  endif
 endif
 
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-ifeq ($(shell gcc -Wno-unused-but-set-variable -Werror -E - < /dev/null > /dev/null 2>&1; echo $$?),0)
+ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1)
 CFLAGS_BASE_DRIVER += -Wno-unused-but-set-variable
 endif
 CFLAGS_BASE_DRIVER += -Wno-missing-declarations
-ifeq ($(shell gcc -Wno-maybe-uninitialized -Werror -E - < /dev/null > /dev/null 2>&1; echo $$?),0)
+ifeq ($(shell test $(GCC_VERSION) -ge 46 && echo 1), 1)
 CFLAGS_BASE_DRIVER += -Wno-maybe-uninitialized
 endif
 CFLAGS_BASE_DRIVER += -Wno-strict-prototypes