This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA-v2] testsuite: Avoid auto-import warning on cygwin/mingw


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]