Hi!

Already had noticed something odd here months ago; now finally looked
into it...

On Sat, 28 Mar 2015 13:59:30 -0400, John David Anglin <dave.ang...@bell.net> 
wrote:
> The attached change fixes tcl errors that occur running the complex.exp and 
> go.exp test sets.
> See: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65567>.
> 
> Tested on hppa2.0w-hp-hpux11.11.  Okay for trunk?

(Got approved, and installed as r221765.)

> 2015-03-28  John David Anglin  <dang...@gcc.gnu.org>
> 
>       PR libffi/65567
>       * testsuite/lib/libffi.exp (libffi_feature_test): Use split to ensure
>       lindex is applied to a list.
> 
> Index: testsuite/lib/libffi.exp
> ===================================================================
> --- testsuite/lib/libffi.exp  (revision 221591)
> +++ testsuite/lib/libffi.exp  (working copy)
> @@ -238,7 +239,7 @@
>      set lines [libffi_target_compile $src "" "preprocess" ""]
>      file delete $src
>  
> -    set last [lindex $lines end]
> +    set last [lindex [split $lines] end]
>      return [regexp -- "xyzzy" $last]
>  }

On my several systems, this has the effect that any user of
libffi_feature_test has their test results regress from PASS to
UNSUPPORTED.  Apparently the regexp xyzzy matching doesn't work as
intended.  If I revert your patch, it's OK for me -- but still not for
you, I suppose.  ;-)

How about the followinginstead?  It's conceptually simpler (and similar
to what other such tests are doing), works for me -- but can you also
please test this?

--- libffi/testsuite/lib/libffi.exp
+++ libffi/testsuite/lib/libffi.exp
@@ -227,20 +227,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 [split $lines] end]
-    return [regexp -- "xyzzy" $last]
+    return [string match "" $lines]
 }
 
 # Utility routines.


Grüße
 Thomas

Attachment: signature.asc
Description: PGP signature

Reply via email to