From: Janis Johnson Date: Mon, 19 Dec 2005 22:29:59 +0000 (+0000) Subject: target-supports.exp (get_compiler_messages, [...]): New. X-Git-Tag: releases/gcc-3.4.6~227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=027b85f615e5c19685661588326429ac1df4f15e;p=thirdparty%2Fgcc.git target-supports.exp (get_compiler_messages, [...]): New. * lib/target-supports.exp (get_compiler_messages, current_target_name): New. From-SVN: r108813 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8973fdc12562..5bcd2672142a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2005-12-19 Janis Johnson + Backport (missed in previous batch): + + * lib/target-supports.exp (get_compiler_messages, + current_target_name): New (missed in backport). + Backport: 2005-02-11 Janis Johnson diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index e6b51ce5b7de..a2dde90e3811 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -19,6 +19,47 @@ # This file defines procs for determining features supported by the target. +# Try to compile some code and return the messages printed by the compiler. +# +# BASENAME is a basename to use for temporary files. +# TYPE is the type of compilation to perform (see target_compile). +# CONTENTS gives the contents of the input file. +# The rest is optional: +# OPTIONS: additional compiler options to use. +proc get_compiler_messages {basename type contents args} { + global tool + + if { [llength $args] > 0 } { + set options "additional_flags=[lindex $args 0]" + } else { + set options "" + } + + set src ${basename}[pid].c + switch $type { + assembly { set output ${basename}[pid].s } + object { set output ${basename}[pid].o } + } + set f [open $src "w"] + puts $f $contents + close $f + set lines [${tool}_target_compile $src $output $type "$options"] + file delete $src + remote_file build delete $output + + return $lines +} + +proc current_target_name { } { + global target_info + if [info exists target_info(target,name)] { + set answer $target_info(target,name) + } else { + set answer "" + } + return $answer +} + ############################### # proc check_weak_available { } ###############################