i2c: Build core and algo drivers with -Wshadow
Subsystems (2)
PATCH 1/1 i2c: Build core and algo drivers with -Wshadow
I like building with -Wshadow, it helps catch bugs or at least bad choices in variable names.
---
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(+)
drivers/i2c/Makefile +1 -0
@@ -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
drivers/i2c/algos/Makefile +1 -0
@@ -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
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Jean Delvare
I like building with -Wshadow, it helps catch bugs or at least bad choices in variable names.
Signed-off-by Jean Delvare <[email protected]>Cc Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>Cc Wolfram Sang <[email protected]>---
Any objection?
[After some searching]
Do you know if -Wshadow has improved since this thread?
http://kerneltrap.org/node/7434
Regards,
Wolfram
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Wolfram Sang
Quoted 8 lines · Jean Delvare
I like building with -Wshadow, it helps catch bugs or at least bad choices in variable names.
Signed-off-by Jean Delvare <[email protected]>Cc Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>Cc Wolfram Sang <[email protected]>---
Any objection?
Quoted 5 lines
[After some searching]
Do you know if -Wshadow has improved since this thread?
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.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines
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...
Signature · 2 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 17 lines · Jean Delvare
Quoted 10 lines · Wolfram Sang
Quoted 8 lines · Jean Delvare
I like building with -Wshadow, it helps catch bugs or at least bad choices in variable names.
Signed-off-by Jean Delvare <[email protected]>Cc Jonathan Cameron <jic23-KWPb1pKIrIJaa/[email protected]>Cc Wolfram Sang <[email protected]>---
Any objection?Quoted 5 lines
[After some searching]
Do you know if -Wshadow has improved since this thread?
Quoted 7 lines
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.
Signature · 1 line
Jean Delvare