Use the proper C++ compiler to run C++ tests
authorJosh Triplett <josh@joshtriplett.org>
Thu, 27 Mar 2014 06:17:56 +0000 (23:17 -0700)
committerJosh Triplett <josh@joshtriplett.org>
Thu, 27 Mar 2014 07:40:27 +0000 (00:40 -0700)
Running the C compiler with -shared-libgcc -lstdc++ does not work on
non-GCC compilers.

.travis.yml
configure.ac
testsuite/lib/libffi.exp
testsuite/libffi.call/call.exp

index 6cf07912f44882c9f2fe6b4b12dacdce58fd756e..6c14fcd0b0ec113472430c00d30eb22f145e0797 100644 (file)
@@ -1,4 +1,4 @@
-language: c
+language: cpp
 compiler:
   - gcc
   - clang
@@ -12,7 +12,7 @@ matrix:
 
 before_script:
   - sudo apt-get install dejagnu texinfo
-  - if [ "$HOST" = i386-pc-linux-gnu ] ; then sudo apt-get install gcc-multilib g++-multilib && CC="$CC -m32" ; fi
+  - if [ "$HOST" = i386-pc-linux-gnu ] ; then sudo apt-get install gcc-multilib g++-multilib && CC="$CC -m32" && CXX="$CXX -m32" ; fi
 
 script:
   - ./autogen.sh
index 0369b308a9965171254f180ee3731422a6bca5cf..305809540fe1b5ef0eff9e1a8b31d716642730c1 100644 (file)
@@ -29,6 +29,7 @@ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
 m4_define([_AC_ARG_VAR_PRECIOUS],[])
 save_CFLAGS=$CFLAGS
 AC_PROG_CC
+AC_PROG_CXX
 CFLAGS=$save_CFLAGS
 m4_undefine([_AC_ARG_VAR_PRECIOUS])
 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
@@ -57,6 +58,7 @@ fi
 
 cat > local.exp <<EOF
 set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
 EOF
 
 AM_MAINTAINER_MODE
index 28d6036938a073fe77a35914a6f041eac85eba24..dbdd1a2f27c220242f5abac798db59882050c1d6 100644 (file)
@@ -222,6 +222,10 @@ proc libffi_target_compile { source dest type options } {
        lappend options "libs= -lpthread"
     }
 
+    if { [string match "*.cc" $source] } {
+       lappend options "c++"
+    }
+
     verbose "options: $options"
     return [target_compile $source $dest $type $options]
 }
index 90e400f6b6ef80af03a4758a50d2b77f71f14496..36d13d8e08d778132ca8afa998700486faab8e11 100644 (file)
@@ -19,10 +19,7 @@ libffi-init
 
 global srcdir subdir
 
-run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""
-if { [string match $using_gcc "yes"] } {
-  run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] "-shared-libgcc -lstdc++"
-}
+run-many-tests [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] ""
 
 dg-finish