From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98846 invoked by alias); 18 Jan 2016 16:28:36 -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 98826 invoked by uid 89); 18 Jan 2016 16:28:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=BAYES_00,KAM_TK,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=upvar, UD:tk, UD:1.html, Expect X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 18 Jan 2016 16:28:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 6395C14A83; Mon, 18 Jan 2016 16:28:32 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0IGSUKn029458; Mon, 18 Jan 2016 11:28:31 -0500 Message-ID: <569D12AE.6060703@redhat.com> Date: Mon, 18 Jan 2016 16:28:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] testsuite: Remove unused global references in gdb_test References: <1453133632-32710-1-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1453133632-32710-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00385.txt.bz2 On 01/18/2016 04:13 PM, Simon Marchi wrote: > Those are unused since gdb_test_multiple was added, factoring out most > of the content of gdb_test. > > If it was C code, I would push it as obvious, but because TCL is always > full of surprises, I am playing it safe. Yeah... And there's one for you here. :-) > --- > gdb/testsuite/lib/gdb.exp | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 52220d0..f3f53b7 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -976,10 +976,7 @@ proc gdb_test_multiple { command message user_code } { > # -1 if there was an internal error. > # > proc gdb_test { args } { > - global verbose > global gdb_prompt > - global GDB > - upvar timeout timeout The upvar should stay. I think this just follows standard procedure for expect: http://www.tcl.tk/man/expect5.31/expect.1.html "Expect takes a rather liberal view of scoping. In particular, variables read by commands specific to the Expect program will be sought first from the local scope, and if not found, in the global scope. For example, this obviates the need to place "global timeout" in every procedure you write that uses expect." See also get_largest_timeout. So gdb_test_multiple will look at the timeout in the caller, which will be gdb_test. And this upvar then makes gdb_test_multiple actually look at the timeout variable in gdb_test's caller frame. Thanks, Pedro Alves