public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Remove unused global references in gdb_test
@ 2016-01-18 16:14 Simon Marchi
  2016-01-18 16:28 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2016-01-18 16:14 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_test): Remove unused global references.
---
 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
 
     if [llength $args]>2 then {
 	set message [lindex $args 2]
-- 
2.5.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Remove unused global references in gdb_test
  2016-01-18 16:14 [PATCH] testsuite: Remove unused global references in gdb_test Simon Marchi
@ 2016-01-18 16:28 ` Pedro Alves
  2016-01-18 16:58   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2016-01-18 16:28 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Remove unused global references in gdb_test
  2016-01-18 16:28 ` Pedro Alves
@ 2016-01-18 16:58   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2016-01-18 16:58 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 16-01-18 11:28 AM, Pedro Alves wrote:
>> ---
>>  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.

Ahh, thanks.  I knew there was something.

I pushed it with "upvar timeout timeout" kept.


From cdd9114f5737fdfbb3c828af3a118fec8aafc26f Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@ericsson.com>
Date: Mon, 18 Jan 2016 11:08:12 -0500
Subject: [PATCH] testsuite: Remove unused global references in gdb_test

Those are unused since gdb_test_multiple was added, factoring out most
of the content of gdb_test.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_test): Remove unused global references.
---
 gdb/testsuite/lib/gdb.exp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 52220d0..e6fe62c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -976,9 +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

     if [llength $args]>2 then {
-- 
2.5.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-18 16:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-18 16:14 [PATCH] testsuite: Remove unused global references in gdb_test Simon Marchi
2016-01-18 16:28 ` Pedro Alves
2016-01-18 16:58   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).