This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] Compile GDB with -Wshadow? (was: "Re: [rfa] function parameter shadowed by local variable in opencl-lang.c")
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 28 Feb 2011 08:57:35 +0400
- Subject: [RFC] Compile GDB with -Wshadow? (was: "Re: [rfa] function parameter shadowed by local variable in opencl-lang.c")
- References: <4D698B92.3070309@vmware.com> <4D698C33.9040101@vmware.com> <20110228045225.GC30306@adacore.com>
> I wish the compiler would warn us about things like this... The patch
> looks correct to me, but I will let Ken and Ulrich take a look. Perhaps
> they'll be able to suggest a more specific name than `length2' ;-).
Howzabout we add -Wshadow to the list of warning compiler switches
for GCC? Something like this (untested for now, just to give an idea
for this discussion)...
--
Joel
diff --git a/gdb/configure.ac b/gdb/configure.ac
index f31ef2a..ea0cda9 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1753,7 +1753,7 @@ fi
build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
-Wformat-nonliteral -Wno-pointer-sign \
-Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts"
+-Wno-switch -Wno-char-subscripts -Wshadow"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.