Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Paul Gilliam <pgilliam@us.ibm.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] get_compiler_info should cache it's results
Date: Fri, 11 Mar 2005 00:41:00 -0000	[thread overview]
Message-ID: <20050311004118.GA28552@nevyn.them.org> (raw)
In-Reply-To: <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


      reply	other threads:[~2005-03-11  0:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-11  0:01 Paul Gilliam
2005-03-11  0:41 ` Daniel Jacobowitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050311004118.GA28552@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=pgilliam@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox