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

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'.


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

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

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=200503101557.05919.pgilliam@us.ibm.com \
    --to=pgilliam@us.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.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