* [RFC] get_compiler_info should cache it's results
@ 2005-03-11 0:01 Paul Gilliam
2005-03-11 0:41 ` Daniel Jacobowitz
0 siblings, 1 reply; 2+ messages in thread
From: Paul Gilliam @ 2005-03-11 0:01 UTC (permalink / raw)
To: gdb-patches; +Cc: Daniel Jacobowitz
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?
-=# 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 just realized that this ignores the second argument to 'get_compiler_info'
which defaults to 'c' but could be 'c++' (and someday may be ada, fortran,
pascal ...) I guess my 'compile_flags' would need a 'language' argument to
pass to 'get_compiler_info', which could cache it's results with an array
indexed by 'language'.
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [RFC] get_compiler_info should cache it's results
2005-03-11 0:01 [RFC] get_compiler_info should cache it's results Paul Gilliam
@ 2005-03-11 0:41 ` Daniel Jacobowitz
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2005-03-11 0:41 UTC (permalink / raw)
To: Paul Gilliam; +Cc: gdb-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-11 0:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-11 0:01 [RFC] get_compiler_info should cache it's results Paul Gilliam
2005-03-11 0:41 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox