Commit c88455178151bea14b8561ab6830724c31af255e

Thomas Schwinge 2016-02-25T20:10:18

Simplify/fix libffi_feature_test As detailed in <http://news.gmane.org/find-root.php?message_id=%3C87wppswqqt.fsf%40kepler.schwinge.homeip.net%3E>, the original code (originally added in commit f1301a54bb80e6ae23f7687c68f36875dae69134 as part of pull request #145) does not work (at least not for me, in the GCC environment).

diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 0d74627..e3e6b34 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -225,20 +225,21 @@ proc libffi_target_compile { source dest type options } {
 
 # TEST should be a preprocessor condition.  Returns true if it holds.
 proc libffi_feature_test { test } {
-    set src "ffitest.c"
+    set src "ffitest[pid].c"
 
     set f [open $src "w"]
     puts $f "#include <ffi.h>"
     puts $f $test
-    puts $f "xyzzy"
+    puts $f "/* OK */"
+    puts $f "#else"
+    puts $f "# error Failed $test"
     puts $f "#endif"
     close $f
 
-    set lines [libffi_target_compile $src "" "preprocess" ""]
+    set lines [libffi_target_compile $src /dev/null assembly ""]
     file delete $src
 
-    set last [lindex $lines end]
-    return [regexp -- "xyzzy" $last]
+    return [string match "" $lines]
 }
 
 # Utility routines.