From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6507 invoked by alias); 5 Dec 2011 11:25:40 -0000 Received: (qmail 6462 invoked by uid 22791); 5 Dec 2011 11:25:39 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Dec 2011 11:25:26 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EED732BB378; Mon, 5 Dec 2011 06:25:25 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 0J31G6YajlEA; Mon, 5 Dec 2011 06:25:25 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B42412BB376; Mon, 5 Dec 2011 06:25:25 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 69675145615; Mon, 5 Dec 2011 03:25:23 -0800 (PST) Date: Mon, 05 Dec 2011 11:25:00 -0000 From: Joel Brobecker To: Andrey Smirnov , Pedro Alves , Jan Kratochvil Cc: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: [PATCH 033/238] [misc.] breakpoint.c: -Wshadow fix Message-ID: <20111205112523.GJ2777@adacore.com> References: <1322493153-29512-1-git-send-email-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1322493153-29512-1-git-send-email-andrew.smirnov@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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 X-SW-Source: 2011-12/txt/msg00124.txt.bz2 > Cause: > Variable in the inner scope shadowed by variable from outer > one(defined at the beginning of function. [...] > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 1a4974c..69a8782 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -10667,8 +10667,8 @@ update_global_location_list (int should_insert) > { > /* ALL_BP_LOCATIONS bp_location has LOC->OWNER always > non-NULL. */ > - struct breakpoint *b = loc->owner; > struct bp_location **loc_first_p; > + b = loc->owner; > > if (b->enable_state == bp_disabled > || b->enable_state == bp_call_disabled I looked at it, and it looks fine from a functional point of view. However, I'd rather have Jan or Pedro, who have modified this function more often than I have, to weigh in. Personally, I'm not keen on the fact that a global variable is reused in the context of a local loop. So I would rather rename the local variable inside the loop rather than delete the local variable, and reuse the global one. It makes for a bigger patch, but I think it's better in the end. -- Joel