Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] In testsuite, make 'test_compiler_info' work like 'istarget'
@ 2005-04-06 21:11 Paul Gilliam
  2005-04-06 21:14 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gilliam @ 2005-04-06 21:11 UTC (permalink / raw)
  To: gdb-patches

The dejagnu procedure 'test_compiler_info' works in much the same way as the dejagnu procedure
''istarget': it takes a pattern as argument and tests that pattern against a magic string.  Unlike
'istarget', 'test_compiler_info' does not return the magic string if the argument is null.  This patch
fixes that.

With this patch, you can do this:

	switch -glob [test_compiler_info] {
		"gcc-1-*"	{ set gcc_compiled 1 }
		"gcc-2-*" 	{ set gcc_compiled 2 }
		"gcc-3-*"	{ set gcc_compiled 3 }
		"gcc-4-*"	{ set gcc_compiled 4 }
		"gcc-5-*"	{ set gcc_compiled 5 }
		"hpcc-*"	{ set hp_cc_compiler 1 }
		"hpacc-*"	{ set hp_aCC_compiler 1 }
                 default	{ warning "unknown compiler" }
	}

instead of this:

	if {[test_compiler_info "gcc-1-*"]}		then  { set gcc_compiled 1 
	} elseif {[test_compiler_info "gcc-2-*"]}	then  { set gcc_compiled 2 
	} elseif {[test_compiler_info "gcc-3-*"]}	then  { set gcc_compiled 3 
	} elseif {[test_compiler_info "gcc-4-*"]}	then  { set gcc_compiled 4 
	} elseif {[test_compiler_info "gcc-5-*" ]}	then  { set gcc_compiled 5 
	} elseif {[test_compiler_info "hpcc-*" ]}	then  { set hp_cc_compiler 1 
	} elseif {[test_compiler_info "hpacc-*"]}	then  { set hp_aCC_compiler 1 
        } else { warning "unknown compiler" }

Of course you could do the following, but that would be cheating, right?

        global compiler_info
	switch -glob $compiler_info {
		"gcc-1-*"	{ set gcc_compiled 1 }
		"gcc-2-*" 	{ set gcc_compiled 2 }
		"gcc-3-*"	{ set gcc_compiled 3 }
		"gcc-4-*"	{ set gcc_compiled 4 }
		"gcc-5-*"	{ set gcc_compiled 5 }
		"hpcc-*"	{ set hp_cc_compiler 1 }
		"hpacc-*"	{ set hp_aCC_compiler 1 }
                 default	{ warning "unknown compiler" }
	}

OK to commit?

-=# Paul #=-

--
2005-04-06  Paul Gilliam  <pgilliam@us.ibm.com>

	* testsuite/lib/gdb.exp: Make 'test_compiler_info' work like
        'istarget' - return compiler_info if null argument.

Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.58
diff -c -3 -p -r1.58 gdb.exp
*** lib/gdb.exp	10 Sep 2004 01:04:59 -0000	1.58
--- lib/gdb.exp	6 Apr 2005 20:38:35 -0000
*************** proc get_compiler_info {binfile args} {
*** 1293,1298 ****
--- 1293,1309 ----
  
  proc test_compiler_info { compiler } {
      global compiler_info
+ 
+     # if no arg, return the compiler_info string
+ 
+     if [string match "" $compiler] {
+         if [info exists compiler_info] {
+             return $compiler_info
+         } else {
+             perror "No compiler info found."
+         }
+     }
+ 
      return [string match $compiler $compiler_info]
  }
  


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

* Re: [patch] In testsuite, make 'test_compiler_info' work like 'istarget'
  2005-04-06 21:11 [patch] In testsuite, make 'test_compiler_info' work like 'istarget' Paul Gilliam
@ 2005-04-06 21:14 ` Daniel Jacobowitz
  2005-04-06 21:41   ` [commit] " Paul Gilliam
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-04-06 21:14 UTC (permalink / raw)
  To: Paul Gilliam; +Cc: gdb-patches

On Wed, Apr 06, 2005 at 01:08:50PM -0800, Paul Gilliam wrote:
> OK to commit?
> 
> -=# Paul #=-
> 
> --
> 2005-04-06  Paul Gilliam  <pgilliam@us.ibm.com>
> 
> 	* testsuite/lib/gdb.exp: Make 'test_compiler_info' work like
>         'istarget' - return compiler_info if null argument.

OK.  Please use this ChangeLog entry instead:

	* testsuite/lib/gdb.exp (test_compiler_info): Return
	compiler_info if no arguments are given.

Describes what function is being changed, and what change was made to
it, but not why.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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

* [commit] In testsuite, make 'test_compiler_info' work like 'istarget'
  2005-04-06 21:14 ` Daniel Jacobowitz
@ 2005-04-06 21:41   ` Paul Gilliam
  2005-04-06 21:43     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Gilliam @ 2005-04-06 21:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Daniel Jacobowitz

I made one tiny change to fit in with the ohter entries in the ChangeLog.

Here is the patch I committed:

2005-04-06  Paul Gilliam  <pgilliam@us.ibm.com>

        * lib/gdb.exp (test_compiler_info): Return  compiler_info
        if no arguments are given.

Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.58
diff -c -3 -p -r1.58 gdb.exp
*** lib/gdb.exp	10 Sep 2004 01:04:59 -0000	1.58
--- lib/gdb.exp	6 Apr 2005 20:38:35 -0000
*************** proc get_compiler_info {binfile args} {
*** 1293,1298 ****
--- 1293,1309 ----
  
  proc test_compiler_info { compiler } {
      global compiler_info
+ 
+     # if no arg, return the compiler_info string
+ 
+     if [string match "" $compiler] {
+         if [info exists compiler_info] {
+             return $compiler_info
+         } else {
+             perror "No compiler info found."
+         }
+     }
+ 
      return [string match $compiler $compiler_info]
  }
  


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

* Re: [commit] In testsuite, make 'test_compiler_info' work like 'istarget'
  2005-04-06 21:41   ` [commit] " Paul Gilliam
@ 2005-04-06 21:43     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-04-06 21:43 UTC (permalink / raw)
  To: gdb-patches

On Wed, Apr 06, 2005 at 01:38:34PM -0800, Paul Gilliam wrote:
> I made one tiny change to fit in with the ohter entries in the ChangeLog.
> 
> Here is the patch I committed:
> 
> 2005-04-06  Paul Gilliam  <pgilliam@us.ibm.com>
> 
>         * lib/gdb.exp (test_compiler_info): Return  compiler_info
>         if no arguments are given.

Er, yeah.  Thanks for catching the extra testsuite/.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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

end of thread, other threads:[~2005-04-06 21:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-06 21:11 [patch] In testsuite, make 'test_compiler_info' work like 'istarget' Paul Gilliam
2005-04-06 21:14 ` Daniel Jacobowitz
2005-04-06 21:41   ` [commit] " Paul Gilliam
2005-04-06 21:43     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox