From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2932 invoked by alias); 11 Mar 2005 00:41:28 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2900 invoked from network); 11 Mar 2005 00:41:25 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 11 Mar 2005 00:41:25 -0000 Received: from drow by nevyn.them.org with local (Exim 4.44 #1 (Debian)) id 1D9YDP-0007Sh-0k; Thu, 10 Mar 2005 19:41:19 -0500 Date: Fri, 11 Mar 2005 00:41:00 -0000 From: Daniel Jacobowitz To: Paul Gilliam Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC] get_compiler_info should cache it's results Message-ID: <20050311004118.GA28552@nevyn.them.org> Mail-Followup-To: Paul Gilliam , gdb-patches@sources.redhat.com References: <200503101557.05919.pgilliam@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200503101557.05919.pgilliam@us.ibm.com> User-Agent: Mutt/1.5.6+20040907i X-SW-Source: 2005-03/txt/msg00180.txt.bz2 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