From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31142 invoked by alias); 2 Oct 2009 18:09:54 -0000 Received: (qmail 31132 invoked by uid 22791); 2 Oct 2009 18:09:53 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Oct 2009 18:09:50 +0000 Received: (qmail 11508 invoked from network); 2 Oct 2009 18:09:45 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 2 Oct 2009 18:09:45 -0000 From: Pedro Alves To: "Pierre Muller" Subject: Re: [RFA-v2] testsuite: Avoid auto-import warning on cygwin/mingw Date: Fri, 02 Oct 2009 18:09:00 -0000 User-Agent: KMail/1.9.10 Cc: gdb-patches@sourceware.org References: <000f01ca42e3$e13cad60$a3b60820$@u-strasbg.fr> <200910020123.53952.pedro@codesourcery.com> <009701ca4332$114bda50$33e38ef0$@u-strasbg.fr> In-Reply-To: <009701ca4332$114bda50$33e38ef0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910021909.47860.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2009-10/txt/msg00063.txt.bz2 On Friday 02 October 2009 08:29:24, Pierre Muller wrote: > > > Did you mean 'lappend options'? > > No, appending to options > would mean that this addition would be parsed by the loop > 'foreach opt $options {' > of line 1713, > while adding it to new_options like it > is done also below for 'shlib_load'. > > > Furthermore, I always feel uncomfortable > when code inside a loop changes the variable > on which the loop is performed (options in that case.) > Wouldn't it be better to also > append to new_options for the two conditions above? > > So, what about this? Hmmm, I would have thought that foreach would still only iterate over the original elements of $options (since foreach takes the values of $options, not the variable reference), no matter if you lappend to options; or am I confused, and does it really keep iterating over newly append items? It would seem like those "lappend options" are actually dead code. Otherwise, appending to `options' means that those new items always ended on $new_options after all the original options, but I don't think it matters here. Either patch looks ok to me, although you got me a bit confused with tcl's foreach now. :-) -- Pedro Alves