aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2023-05-10 15:01:55 +0200
committerThomas Schwinge <thomas@codesourcery.com>2023-05-15 12:11:18 +0200
commit982c869ec00c72176ddede9c0e3068c76dc871d2 (patch)
tree81db1e6219e4125f5b1adefe72d98d6473b6ef1c /libgomp
parent30e42bb66d39f542cb76e40ad367a7ae7f376dc7 (diff)
downloadgcc-982c869ec00c72176ddede9c0e3068c76dc871d2.zip
gcc-982c869ec00c72176ddede9c0e3068c76dc871d2.tar.gz
gcc-982c869ec00c72176ddede9c0e3068c76dc871d2.tar.bz2
libgomp testsuite: As appropriate, use the 'gcc', 'g++', 'gfortran' driver [PR91884]
..., that is, 'GCC_UNDER_TEST', 'GXX_UNDER_TEST', 'GFORTRAN_UNDER_TEST' instead of 'GCC_UNDER_TEST' for all of them. No need anymore for 'gcc -lstdc++ -x c++' for C++ code, or 'gcc -lgfortran' plus conditional '-lquadmath' for Fortran code. (Getting rid of explicit '-foffload=-lgfortran' is for another day.) PR testsuite/91884 libgomp/ * configure.ac: 'AC_SUBST(CXX)'. * configure: Regenerate. * Makefile.in: Likewise. * testsuite/Makefile.in: Likewise. * testsuite/libgomp-site-extra.exp.in (GXX_UNDER_TEST) (GFORTRAN_UNDER_TEST): Set. * testsuite/lib/libgomp.exp (libgomp_init): Adjust. * testsuite/libgomp.c++/c++.exp: Use 'GXX_UNDER_TEST'. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.fortran/fortran.exp: Use 'GFORTRAN_UNDER_TEST'. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/Makefile.in1
-rwxr-xr-xlibgomp/configure18
-rw-r--r--libgomp/configure.ac13
-rw-r--r--libgomp/testsuite/Makefile.in1
-rw-r--r--libgomp/testsuite/lib/libgomp.exp35
-rw-r--r--libgomp/testsuite/libgomp-site-extra.exp.in2
-rw-r--r--libgomp/testsuite/libgomp.c++/c++.exp22
-rw-r--r--libgomp/testsuite/libgomp.fortran/fortran.exp11
-rw-r--r--libgomp/testsuite/libgomp.oacc-c++/c++.exp22
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/fortran.exp11
10 files changed, 71 insertions, 65 deletions
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 2c81cca..9558535 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -368,6 +368,7 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPU_COUNT = @CPU_COUNT@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
diff --git a/libgomp/configure b/libgomp/configure
index fd0e337..33f8471 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -678,6 +678,7 @@ libtool_VERSION
ac_ct_FC
FCFLAGS
FC
+CXX
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
@@ -11418,7 +11419,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11421 "configure"
+#line 11422 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11524,7 +11525,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11527 "configure"
+#line 11528 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11810,11 +11811,22 @@ fi
+# We optionally test libgomp C++ support, and for that want to use the proper
+# C++ driver, 'g++' (or 'xg++' for build-tree testing). Given that build of
+# target libstdc++-v3 depends on target libgomp (see '../Makefile.def'), we
+# cannot make build of target libgomp depend on target libstdc++-v3: circular
+# dependency. We thus cannot instantiate 'AC_PROG_CXX' here: we'd get
+# '-funconfigured-libstdc++-v3' (see '../configure.ac'). Therefore, just
+# capture 'CXX', and we'll fix this up at 'make check' time (see
+# 'testsuite/lib/libgomp.exp:libgomp_init').
+
+
# Create a spec file, so that compile/link tests don't fail
test -f libgfortran.spec || touch libgfortran.spec
FCFLAGS="$FCFLAGS -L."
-# We need gfortran to compile parts of the library
+# We need 'gfortran' to compile parts of the library, and test libgomp Fortran
+# support.
# We can't use AC_PROG_FC because it expects a fully working gfortran.
#AC_PROG_FC(gfortran)
case `echo $GFORTRAN` in
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index a9b1f39..46619d7 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -152,11 +152,22 @@ AC_SUBST(enable_static)
AM_MAINTAINER_MODE
+# We optionally test libgomp C++ support, and for that want to use the proper
+# C++ driver, 'g++' (or 'xg++' for build-tree testing). Given that build of
+# target libstdc++-v3 depends on target libgomp (see '../Makefile.def'), we
+# cannot make build of target libgomp depend on target libstdc++-v3: circular
+# dependency. We thus cannot instantiate 'AC_PROG_CXX' here: we'd get
+# '-funconfigured-libstdc++-v3' (see '../configure.ac'). Therefore, just
+# capture 'CXX', and we'll fix this up at 'make check' time (see
+# 'testsuite/lib/libgomp.exp:libgomp_init').
+AC_SUBST(CXX)
+
# Create a spec file, so that compile/link tests don't fail
test -f libgfortran.spec || touch libgfortran.spec
FCFLAGS="$FCFLAGS -L."
-# We need gfortran to compile parts of the library
+# We need 'gfortran' to compile parts of the library, and test libgomp Fortran
+# support.
# We can't use AC_PROG_FC because it expects a fully working gfortran.
#AC_PROG_FC(gfortran)
case `echo $GFORTRAN` in
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 7a88f0f..4e8b21e 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -147,6 +147,7 @@ CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPU_COUNT = @CPU_COUNT@
+CXX = @CXX@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 48c43e4..30d67e4 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -66,7 +66,7 @@ proc libgomp_init { args } {
global ALWAYS_CFLAGS
global CFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
- global GCC_UNDER_TEST
+ global GCC_UNDER_TEST GXX_UNDER_TEST GFORTRAN_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
global always_ld_library_path
@@ -85,12 +85,45 @@ proc libgomp_init { args } {
setenv LANG C.ASCII
}
+ if { $blddir != "" } {
+ # Fix up '-funconfigured-libstdc++-v3' in 'GXX_UNDER_TEST' (see
+ # '../../configure.ac').
+ set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
+ if { [file exists $flags_file] } {
+ set flags [exec sh $flags_file --build-includes]
+ verbose -log "GXX_UNDER_TEST = $GXX_UNDER_TEST"
+ set GXX_UNDER_TEST [string map [list \
+ " -funconfigured-libstdc++-v3 " " $flags " \
+ ] $GXX_UNDER_TEST]
+ verbose -log "GXX_UNDER_TEST = $GXX_UNDER_TEST"
+ }
+ }
if ![info exists GCC_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set GCC_UNDER_TEST $TOOL_EXECUTABLE
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
+ # Only if we're guessing 'GCC_UNDER_TEST', we're also going to guess
+ # 'GXX_UNDER_TEST', 'GFORTRAN_UNDER_TEST'.
+ if ![info exists GXX_UNDER_TEST] then {
+ if [info exists TOOL_EXECUTABLE] {
+ set GXX_UNDER_TEST $TOOL_EXECUTABLE
+ } else {
+ set GXX_UNDER_TEST "[find_g++]"
+ }
+ } else {
+ error "GXX_UNDER_TEST set but not GCC_UNDER_TEST"
+ }
+ if ![info exists GFORTRAN_UNDER_TEST] then {
+ if [info exists TOOL_EXECUTABLE] {
+ set GFORTRAN_UNDER_TEST $TOOL_EXECUTABLE
+ } else {
+ set GFORTRAN_UNDER_TEST "[find_gfortran]"
+ }
+ } else {
+ error "GFORTRAN_UNDER_TEST set but not GCC_UNDER_TEST"
+ }
}
if ![info exists tmpdir] {
diff --git a/libgomp/testsuite/libgomp-site-extra.exp.in b/libgomp/testsuite/libgomp-site-extra.exp.in
index c0d2666..15407ab 100644
--- a/libgomp/testsuite/libgomp-site-extra.exp.in
+++ b/libgomp/testsuite/libgomp-site-extra.exp.in
@@ -1 +1,3 @@
set GCC_UNDER_TEST {@CC@}
+set GXX_UNDER_TEST {@CXX@}
+set GFORTRAN_UNDER_TEST {@FC@}
diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp
index 4110ada..8b4563b 100644
--- a/libgomp/testsuite/libgomp.c++/c++.exp
+++ b/libgomp/testsuite/libgomp.c++/c++.exp
@@ -15,12 +15,7 @@ if { $blddir != "" } {
verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
return
}
-set lang_link_flags "-lstdc++"
-# Switch into C++ mode. Otherwise, the 'libgomp.c-c++-common/*.c'
-# files would be compiled as C files.
-set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
-set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
-lappend ALWAYS_CFLAGS "compiler=$GCC_UNDER_TEST"
+lappend ALWAYS_CFLAGS "compiler=$GXX_UNDER_TEST"
# If a testcase doesn't have special options, use these.
if ![info exists DEFAULT_CFLAGS] then {
@@ -45,28 +40,13 @@ if { $blddir != "" } {
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
-set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
-if { $blddir != ""
- && [file exists $flags_file] } {
- set lang_source_re {^.*\.[cC]$}
- set lang_include_flags [exec sh $flags_file --build-includes]
-}
-
# Main loop.
dg-runtest $tests "" $DEFAULT_CFLAGS
-# See above.
-set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
-
-if [info exists lang_include_flags] then {
- unset lang_source_re
- unset lang_include_flags
-}
if { $blddir != "" } {
unset libstdc++_library_path
unset lang_library_paths
}
-unset lang_link_flags
# All done.
dg-finish
diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp
index 9aeebd3..e69656b 100644
--- a/libgomp/testsuite/libgomp.fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.fortran/fortran.exp
@@ -28,8 +28,8 @@ if { $blddir != "" } {
set lang_source_re {^.*\.[fF](|90|95|03|08)$}
set lang_include_flags "-fintrinsic-modules-path=${blddir}"
}
-set lang_link_flags "-lgfortran -foffload=-lgfortran"
-lappend ALWAYS_CFLAGS "compiler=$GCC_UNDER_TEST"
+set lang_link_flags "-foffload=-lgfortran"
+lappend ALWAYS_CFLAGS "compiler=$GFORTRAN_UNDER_TEST"
# Initialize dg.
dg-init
@@ -46,13 +46,6 @@ if { $blddir != "" } {
if { $libquadmath_library_path != "" } {
append ld_library_path ":${blddir}/${libquadmath_library_path}"
- append lang_link_flags " -lquadmath"
- }
-} else {
- if { [check_no_compiler_messages has_libquadmath executable {
- int main() {return 0;}
- } "-lgfortran -lquadmath"] } then {
- append lang_link_flags " -lquadmath"
}
}
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 70fb9da..79df401 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -25,12 +25,7 @@ if { $blddir != "" } {
verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
return
}
-set lang_link_flags "-lstdc++"
-# Switch into C++ mode. Otherwise, the 'libgomp.oacc-c-c++-common/*.c'
-# files would be compiled as C files.
-set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
-set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
-lappend ALWAYS_CFLAGS "compiler=$GCC_UNDER_TEST"
+lappend ALWAYS_CFLAGS "compiler=$GXX_UNDER_TEST"
# Initialize dg.
dg-init
@@ -51,13 +46,6 @@ if { $blddir != "" } {
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
-set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
-if { $blddir != ""
- && [file exists $flags_file] } {
- set lang_source_re {^.*\.[cC]$}
- set lang_include_flags [exec sh $flags_file --build-includes]
-}
-
# Test with all available offload targets, and with offloading disabled.
foreach offload_target [concat [split $offload_targets ","] "disable"] {
global openacc_device_type
@@ -132,18 +120,10 @@ foreach offload_target [concat [split $offload_targets ","] "disable"] {
}
unset offload_target
-# See above.
-set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
-
-if [info exists lang_include_flags] then {
- unset lang_source_re
- unset lang_include_flags
-}
if { $blddir != "" } {
unset libstdc++_library_path
unset lang_library_paths
}
-unset lang_link_flags
# All done.
torture-finish
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 56dd948..2e8aa22 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -30,8 +30,8 @@ if { $blddir != "" } {
set lang_source_re {^.*\.[fF](|90|95|03|08)$}
set lang_include_flags "-fintrinsic-modules-path=${blddir}"
}
-set lang_link_flags "-lgfortran -foffload=-lgfortran"
-lappend ALWAYS_CFLAGS "compiler=$GCC_UNDER_TEST"
+set lang_link_flags "-foffload=-lgfortran"
+lappend ALWAYS_CFLAGS "compiler=$GFORTRAN_UNDER_TEST"
# Initialize dg.
dg-init
@@ -49,13 +49,6 @@ if { $blddir != "" } {
if { $libquadmath_library_path != "" } {
append ld_library_path ":${blddir}/${libquadmath_library_path}"
- append lang_link_flags " -lquadmath"
- }
-} else {
- if { [check_no_compiler_messages has_libquadmath executable {
- int main() {return 0;}
- } "-lgfortran -lquadmath"] } then {
- append lang_link_flags " -lquadmath"
}
}
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]