[dpdk-dev,v3,2/7] drivers/net/e1000: Suppress misleading indentation warning

Message ID f7t60w412mr.fsf_-_@redhat.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Aaron Conole March 30, 2016, 2:06 p.m. UTC
  The register read/write mphy functions have misleading whitespace around
the `locked` check. This cleanup merely preserves the existing functionality
and suppresses future gcc versions' "misleading indentation" warning.

Suggested-by: Panu Matilainen <pmatilai@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
v2:
* Changed from "whitespace-only" fix to a functional change
  moving the phy writes into protection of the `if (locked)`
  code
* Added "Fixes" line.

v3:
* Instead of changing the code, change to suppress the compiler warning
  when using gcc6+. This was tested with both gcc6 and gcc5 using gnu
  make 4.0 and gnu bash 4.3.42 on a fedora 23 system.

 drivers/net/e1000/Makefile | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Stephen Hemminger March 30, 2016, 4:36 p.m. UTC | #1
On Wed, 30 Mar 2016 10:06:36 -0400
Aaron Conole <aconole@redhat.com> wrote:

> The register read/write mphy functions have misleading whitespace around
> the `locked` check. This cleanup merely preserves the existing functionality
> and suppresses future gcc versions' "misleading indentation" warning.
> 
> Suggested-by: Panu Matilainen <pmatilai@redhat.com>
> Signed-off-by: Aaron Conole <aconole@redhat.com>
> ---
> v2:
> * Changed from "whitespace-only" fix to a functional change
>   moving the phy writes into protection of the `if (locked)`
>   code
> * Added "Fixes" line.
> 
> v3:
> * Instead of changing the code, change to suppress the compiler warning
>   when using gcc6+. This was tested with both gcc6 and gcc5 using gnu
>   make 4.0 and gnu bash 4.3.42 on a fedora 23 system.
> 
>  drivers/net/e1000/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
> index ccd2b7b..f4879e6 100644
> --- a/drivers/net/e1000/Makefile
> +++ b/drivers/net/e1000/Makefile
> @@ -54,6 +54,9 @@ else
>  #
>  CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
>  CFLAGS_BASE_DRIVER += -Wno-unused-variable
> +ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
> +CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
> +endif
>  endif
>  
>  #

NAK, don't do it to the whole file.
Fix the code (best option)
or use a pragma for the small area which is broken for other reasons.
  
Thomas Monjalon March 30, 2016, 5:12 p.m. UTC | #2
2016-03-30 09:36, Stephen Hemminger:
> On Wed, 30 Mar 2016 10:06:36 -0400
> Aaron Conole <aconole@redhat.com> wrote:
> > --- a/drivers/net/e1000/Makefile
> > +++ b/drivers/net/e1000/Makefile
> > @@ -54,6 +54,9 @@ else
> >  #
> >  CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
> >  CFLAGS_BASE_DRIVER += -Wno-unused-variable
> > +ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
> > +CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
> > +endif
> >  endif
> 
> NAK, don't do it to the whole file.
> Fix the code (best option)
> or use a pragma for the small area which is broken for other reasons.

Stephen, your solutions do not work because Aaron has not been allowed
to modify this file.
As long as we are not allowed to modify the Intel base drivers,
I don't see any problem to hide some warnings in them.
The warnings could help us to clean the code or fix some bugs but
we are not allowed to...
It is the responsibility of the driver maintainer to keep this nasty code.
  
Stephen Hemminger March 30, 2016, 9:48 p.m. UTC | #3
On Wed, 30 Mar 2016 19:12:39 +0200
Thomas Monjalon <thomas.monjalon@6wind.com> wrote:

> 2016-03-30 09:36, Stephen Hemminger:
> > On Wed, 30 Mar 2016 10:06:36 -0400
> > Aaron Conole <aconole@redhat.com> wrote:
> > > --- a/drivers/net/e1000/Makefile
> > > +++ b/drivers/net/e1000/Makefile
> > > @@ -54,6 +54,9 @@ else
> > >  #
> > >  CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
> > >  CFLAGS_BASE_DRIVER += -Wno-unused-variable
> > > +ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
> > > +CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
> > > +endif
> > >  endif
> > 
> > NAK, don't do it to the whole file.
> > Fix the code (best option)
> > or use a pragma for the small area which is broken for other reasons.
> 
> Stephen, your solutions do not work because Aaron has not been allowed
> to modify this file.
> As long as we are not allowed to modify the Intel base drivers,
> I don't see any problem to hide some warnings in them.
> The warnings could help us to clean the code or fix some bugs but
> we are not allowed to...
> It is the responsibility of the driver maintainer to keep this nasty code.

ok, but the policy of "base drivers are allowed to be unmaintainable" is
an albatross around the neck of DPDK. There is a reason such a policy was rejected
in Linux.
  
Wenzhuo Lu March 31, 2016, 12:41 a.m. UTC | #4
Hi,

> -----Original Message-----
> From: Aaron Conole [mailto:aconole@redhat.com]
> Sent: Wednesday, March 30, 2016 10:07 PM
> To: Thomas Monjalon
> Cc: Panu Matilainen; Lu, Wenzhuo; dev@dpdk.org; Richardson, Bruce
> Subject: [PATCH v3 2/7] drivers/net/e1000: Suppress misleading indentation
> warning
> 
> The register read/write mphy functions have misleading whitespace around the
> `locked` check. This cleanup merely preserves the existing functionality and
> suppresses future gcc versions' "misleading indentation" warning.
> 
> Suggested-by: Panu Matilainen <pmatilai@redhat.com>
> Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
  

Patch

diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index ccd2b7b..f4879e6 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -54,6 +54,9 @@  else
 #
 CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
+ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
+CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
+endif
 endif
 
 #