From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84165 invoked by alias); 23 Sep 2018 04:08:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 84069 invoked by uid 89); 23 Sep 2018 04:08:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_RP_RNBL,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:1215, H*RU:sk:gateway, Hx-spam-relays-external:sk:gateway, latent X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.46.156) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Sep 2018 04:08:20 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 4D659BB5 for ; Sat, 22 Sep 2018 23:08:17 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 3vgvgiHRzBcCX3vgvg5mdM; Sat, 22 Sep 2018 23:08:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=rGRU2Q19DywuI9tjVTjjt3bCr3YbvYUMwz6ZNOHzpiY=; b=QfGilb2dqxPKzk1IOMopEnlolR DbClI4Rag6rrGFebkIk0AflmiFealwLnH/bU+nhi7vZP3vKiK8UHWrJfgXU5BtiuxkRXFUyS9NC/F g0RVMaqv/WPdyAYIA8wNOnbaN; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:37440 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1g3vgv-002UJa-1G for gdb-patches@sourceware.org; Sat, 22 Sep 2018 23:08:17 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 0/8] Add -Wshadow=local Date: Sun, 23 Sep 2018 04:08:00 -0000 Message-Id: <20180923040814.27941-1-tom@tromey.com> X-SW-Source: 2018-09/txt/msg00757.txt.bz2 This series enables -Wshadow=local for gdb. I think that shadowing is mildly confusing, and I normally try to avoid it. However, for a long time, it wasn't feasible to enable any shadowing warnings, because gcc would warn about shadowing that was "uninteresting" -- the classic example being the use of a local variable named "index". In this series I chose to use -Wshadow=local, to forbid shadowing within a function. -Wshadow=compatible-local is another choice, but I think that the stated semantics: In C++, type compatibility here means the type of the shadowing variable can be converted to that of the shadowed variable. ... is maybe insufficient. For example a situation where the two different types are both convertible to a third type could be enough to cause a bug. That's a bit of a reach maybe, but it seemed to me that it's not such a big deal, and certainly always safer, to just disallow shadowing entirely. Adding this warning found a few latent bugs in gdb. Regression tested by the buildbot. Thanks, Sergio, for your work running this -- it is a great service. Let me know what you think. I feel that a change like this should involve some feedback. Tom