Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Michael Snyder <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [RFC] Compile GDB with -Wshadow? (was: "Re: [rfa] function parameter shadowed by local variable in opencl-lang.c")
Date: Mon, 28 Feb 2011 05:01:00 -0000	[thread overview]
Message-ID: <20110228045735.GD30306@adacore.com> (raw)
In-Reply-To: <20110228045225.GC30306@adacore.com>

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

> 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

[-- Attachment #2: wshadow.diff --]
[-- Type: text/x-diff, Size: 496 bytes --]

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.

  reply	other threads:[~2011-02-28  4:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26 23:26 [rfa] function parameter shadowed by local variable in opencl-lang.c Michael Snyder
2011-02-26 23:36 ` Michael Snyder
2011-02-28  4:57   ` Joel Brobecker
2011-02-28  5:01     ` Joel Brobecker [this message]
2011-02-28  5:39       ` [RFC] Compile GDB with -Wshadow? (was: "Re: [rfa] function parameter shadowed by local variable in opencl-lang.c") Jan Kratochvil
2011-02-28  9:09         ` Joel Brobecker
2011-02-28  9:29           ` Mark Kettenis
2011-02-28 18:15             ` [RFC] Compile GDB with -Wshadow? Michael Snyder
2011-02-28 15:48       ` Tom Tromey
2011-02-28 15:23     ` [rfa] function parameter shadowed by local variable in opencl-lang.c Ulrich Weigand
2011-02-28 18:43       ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110228045735.GD30306@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox