Message ID | 20181017170554.18841-2-bigeasy@linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Let sparse check for shadowed variables | expand |
On Wed, Oct 17, 2018 at 07:05:52PM +0200, Sebastian Andrzej Siewior wrote: > I remember that `sparse' used to warn about shadowed variables but it > seems not to do it by default anymore. It was useful. > > Enable `-Wshadow' while invoking sparse. Hi, I made a quick test and I saw it would add a lot of noise because of (valid) warnings coming from macros using a statement expression redeclaring variables like '__u', 'tmp', ... BTW, as far as I can see, sparse never had it enabled by default. Kind regards, -- Luc Van Oostenryck
On 2018-10-17 21:25:02 [+0200], Luc Van Oostenryck wrote: > Hi, Hi, > I made a quick test and I saw it would add a lot of noise because of > (valid) warnings coming from macros using a statement expression > redeclaring variables like '__u', 'tmp', ... > > BTW, as far as I can see, sparse never had it enabled by default. I must have seen those warnings with C=1 _years_ ago otherwise I wouldn't know about that feature. Or it was enabled by the check process and got disabled but I can't find evidence for it. > Kind regards, > -- Luc Van Oostenryck Sebastian
diff --git a/Makefile b/Makefile index bf3786e4ffece..0160c6b5dd45d 100644 --- a/Makefile +++ b/Makefile @@ -390,7 +390,7 @@ PYTHON3 = python3 CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ - -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) + -Wbitwise -Wno-return-void -Wno-unknown-attribute -Wshadow $(CF) NOSTDINC_FLAGS = CFLAGS_MODULE = AFLAGS_MODULE =
I remember that `sparse' used to warn about shadowed variables but it seems not to do it by default anymore. It was useful. Enable `-Wshadow' while invoking sparse. Cc: linux-sparse@vger.kernel.org Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Michal Marek <michal.lkml@markovi.net> Cc: linux-kbuild@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)