]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target-supports.exp (get_compiler_messages, [...]): New.
authorJanis Johnson <janis187@us.ibm.com>
Mon, 19 Dec 2005 22:29:59 +0000 (22:29 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Mon, 19 Dec 2005 22:29:59 +0000 (22:29 +0000)
* lib/target-supports.exp (get_compiler_messages,
current_target_name): New.

From-SVN: r108813

gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp

index 8973fdc12562e0b226d135bbf8445cf4b316003d..5bcd2672142a5feeade8aaf3fde21b78004c3dbb 100644 (file)
@@ -1,5 +1,10 @@
 2005-12-19  Janis Johnson  <janis187@us.ibm.com>
 
+       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  <janis187@us.ibm.com>
index e6b51ce5b7de73f248d18cef672395dd84e5cbfd..a2dde90e3811b8b6f5dfb4f14439a979a005ba14 100644 (file)
 
 # 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 { }
 ###############################