This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC] get_compiler_info should cache it's results
- From: Daniel Jacobowitz <drow at false dot org>
- To: Paul Gilliam <pgilliam at us dot ibm dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 10 Mar 2005 19:41:18 -0500
- Subject: Re: [RFC] get_compiler_info should cache it's results
- References: <200503101557.05919.pgilliam@us.ibm.com>
On Thu, Mar 10, 2005 at 03:57:05PM -0800, Paul Gilliam wrote:
> Hi all,
>
> We are trying to use IBM's xlc compiler with the testsuite and have found
> severial places that break because of differences if flags. For example, gcc
> uses '-shared' but xlc uses '-qmkshrobj' in order to indicate that a shared
> object is to be produced.
>
> I have written a tcl proc that will make this easyer. It's kind of like a
> special front-end to 'test_compiler_info', which depends on
> 'get_compiler_info' being run first.
>
> I would like to run get_compiler_info from within this new proc, but that
> could result in running it multiple times in a given test.
>
> For this reason, I would like 'get_compiler_info' to cache its resluts by
> simply starting the proc with something like:
>
> if [info exists compiler_info] {return 0}
>
> Does anyone see any problems with this?
You need to be slightly more specific - cache it within $board, or
invalidate it somehow. I don't know precisely when. GDB's testsuite
isn't very good about this, but you are supposed to be able to run the
testsuite with multiple compilers in one invocation.
I like the idea though!
>
> -=# Paul #=-
>
> Here is the new proc (so far ;-):
>
> proc compile_flags { arg1 {arg2 ""} } {
> if {"$arg2" == ""} then {
> set list $arg1
> } else {
> upvar $arg1 lvar
> set list $arg2
> }
> if ![info exists lvar] { set lvar {} }
> get_compiler_info not-used
> foreach {pat flist} $list {
> if {$pat == {default}} {
> return [eval $flist]
> } elseif {[test_compiler_info $pat]} {
> foreach flag $flist {
> set lvar "$lvar additional_flags=$flag"
> }
> set lvar [string trim $lvar]
> return $lvar
> }
> }
> return {}
> }
I'm not sure about this bit, though. Could you explain what you want
it to do, and how it would be used? More informative variable names
might help too.
--
Daniel Jacobowitz
CodeSourcery, LLC