linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: Build core and algo drivers with -Wshadow
@ 2010-02-16 11:21 Jean Delvare
       [not found] ` <20100216122152.29dbbeb5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2010-02-16 11:21 UTC (permalink / raw)
  To: Linux I2C; +Cc: Jonathan Cameron, Wolfram Sang

I like building with -Wshadow, it helps catch bugs or at least bad
choices in variable names.

Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
Any objection?

 drivers/hwmon/Makefile      |    1 +
 drivers/i2c/Makefile        |    1 +
 drivers/i2c/algos/Makefile  |    1 +
 drivers/i2c/busses/Makefile |    1 +
 drivers/i2c/chips/Makefile  |    1 +
 5 files changed, 5 insertions(+)

--- linux-2.6.33-rc8.orig/drivers/i2c/Makefile	2010-02-16 10:59:43.000000000 +0100
+++ linux-2.6.33-rc8/drivers/i2c/Makefile	2010-02-16 11:09:07.000000000 +0100
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS)		+= i2c-smbus.o
 obj-$(CONFIG_I2C_CHARDEV)	+= i2c-dev.o
 obj-y				+= busses/ chips/ algos/
 
+EXTRA_CFLAGS += -Wshadow
 ifeq ($(CONFIG_I2C_DEBUG_CORE),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
--- linux-2.6.33-rc8.orig/drivers/i2c/algos/Makefile	2009-06-10 05:05:27.000000000 +0200
+++ linux-2.6.33-rc8/drivers/i2c/algos/Makefile	2010-02-16 11:19:59.000000000 +0100
@@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ALGOBIT)	+= i2c-algo-bi
 obj-$(CONFIG_I2C_ALGOPCF)	+= i2c-algo-pcf.o
 obj-$(CONFIG_I2C_ALGOPCA)	+= i2c-algo-pca.o
 
+EXTRA_CFLAGS += -Wshadow
 ifeq ($(CONFIG_I2C_DEBUG_ALGO),y)
 EXTRA_CFLAGS += -DDEBUG
 endif


-- 
Jean Delvare

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

* Re: [PATCH] i2c: Build core and algo drivers with -Wshadow
       [not found] ` <20100216122152.29dbbeb5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2010-02-16 20:27   ` Wolfram Sang
       [not found]     ` <20100216202715.GC17428-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2010-02-16 20:27 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Linux I2C, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

On Tue, Feb 16, 2010 at 12:21:52PM +0100, Jean Delvare wrote:
> I like building with -Wshadow, it helps catch bugs or at least bad
> choices in variable names.
> 
> Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
> Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
> Any objection?

[After some searching]

Do you know if -Wshadow has improved since this thread?

http://kerneltrap.org/node/7434

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] i2c: Build core and algo drivers with -Wshadow
       [not found]     ` <20100216202715.GC17428-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-02-16 21:53       ` Jean Delvare
       [not found]         ` <20100216225352.1c4c3893-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2010-02-16 21:53 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Jonathan Cameron

On Tue, 16 Feb 2010 21:27:15 +0100, Wolfram Sang wrote:
> On Tue, Feb 16, 2010 at 12:21:52PM +0100, Jean Delvare wrote:
> > I like building with -Wshadow, it helps catch bugs or at least bad
> > choices in variable names.
> > 
> > Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> > Cc: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
> > Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > ---
> > Any objection?
> 
> [After some searching]
> 
> Do you know if -Wshadow has improved since this thread?
> 
> http://kerneltrap.org/node/7434

Probably not. This is the reason why I enabled -Wshadow only in 2
selected subdirectories where I think it makes sense (low driver count)
rather than the whole kernel (or even the whole i2c subsystem.)

The fact that it spotted one (admittedly harmless) bug, and would have
caught my confusing code in i2c-smbus too, make me confident that this
is not too bad an idea.

-- 
Jean Delvare

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

* Re: [PATCH] i2c: Build core and algo drivers with -Wshadow
       [not found]         ` <20100216225352.1c4c3893-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2010-02-17 13:35           ` Wolfram Sang
  2010-02-17 13:44           ` Jean Delvare
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2010-02-17 13:35 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Linux I2C, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

> The fact that it spotted one (admittedly harmless) bug, and would have
> caught my confusing code in i2c-smbus too, make me confident that this
> is not too bad an idea.

OK, no objection from me; still, I think I don't have enough insight for an
ack. We'll see what happens...

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] i2c: Build core and algo drivers with -Wshadow
       [not found]         ` <20100216225352.1c4c3893-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
  2010-02-17 13:35           ` Wolfram Sang
@ 2010-02-17 13:44           ` Jean Delvare
  1 sibling, 0 replies; 5+ messages in thread
From: Jean Delvare @ 2010-02-17 13:44 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Jonathan Cameron

On Tue, 16 Feb 2010 22:53:52 +0100, Jean Delvare wrote:
> On Tue, 16 Feb 2010 21:27:15 +0100, Wolfram Sang wrote:
> > On Tue, Feb 16, 2010 at 12:21:52PM +0100, Jean Delvare wrote:
> > > I like building with -Wshadow, it helps catch bugs or at least bad
> > > choices in variable names.
> > > 
> > > Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> > > Cc: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
> > > Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > > ---
> > > Any objection?
> > 
> > [After some searching]
> > 
> > Do you know if -Wshadow has improved since this thread?
> > 
> > http://kerneltrap.org/node/7434
> 
> Probably not. This is the reason why I enabled -Wshadow only in 2
> selected subdirectories where I think it makes sense (low driver count)
> rather than the whole kernel (or even the whole i2c subsystem.)
> 
> The fact that it spotted one (admittedly harmless) bug, and would have
> caught my confusing code in i2c-smbus too, make me confident that this
> is not too bad an idea.

Oh well, -Wshadow is triggering warnings in header files on some
architectures, so this wasn't really an option. I've discarded the
patch now.

-- 
Jean Delvare

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

end of thread, other threads:[~2010-02-17 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16 11:21 [PATCH] i2c: Build core and algo drivers with -Wshadow Jean Delvare
     [not found] ` <20100216122152.29dbbeb5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-02-16 20:27   ` Wolfram Sang
     [not found]     ` <20100216202715.GC17428-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-02-16 21:53       ` Jean Delvare
     [not found]         ` <20100216225352.1c4c3893-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-02-17 13:35           ` Wolfram Sang
2010-02-17 13:44           ` Jean Delvare

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