From: Jonathan Wakely Date: Fri, 14 Jun 2019 18:10:52 +0000 (+0100) Subject: PR libstdc++/90252 Check TBB version and ability to link with -ltbb X-Git-Tag: releases/gcc-9.2.0~246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11441586ef812e0cdcd535e19f9953ba30ccbf4a;p=thirdparty%2Fgcc.git PR libstdc++/90252 Check TBB version and ability to link with -ltbb Backport from mainline 2019-05-21 Jonathan Wakely PR libstdc++/90252 * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend): Use "additional_flags" to pass -ltbb to v3_target_compile command. Use check_v3_target_prop_cached to cache the result of the test. Backport from mainline 2019-05-20 Thomas Rodgers PR libstdc++/90252 * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend): Changed v3_target_compile check from preprocess to executable. Added "-ltbb" to v3_target_compile flags. Backport from mainline 2019-05-20 Thomas Rodgers * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend): Add check for Thread Building Blocks 2018 or later. From-SVN: r272298 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 55473574a14e..2844d7701ddf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,27 @@ +2019-06-14 Jonathan Wakely + + Backport from mainline + 2019-05-21 Jonathan Wakely + + PR libstdc++/90252 + * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend): + Use "additional_flags" to pass -ltbb to v3_target_compile command. + Use check_v3_target_prop_cached to cache the result of the test. + + Backport from mainline + 2019-05-20 Thomas Rodgers + + PR libstdc++/90252 + * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend): + Changed v3_target_compile check from preprocess to executable. + Added "-ltbb" to v3_target_compile flags. + + Backport from mainline + 2019-05-20 Thomas Rodgers + + * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend): + Add check for Thread Building Blocks 2018 or later. + 2019-06-14 Jonathan Wakely Backport from mainline diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index d0efc90a1baa..1ab896d3deb3 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1607,25 +1607,33 @@ proc check_effective_target_random_device { } { # Return 1 if tbb parallel backend is available proc check_effective_target_tbb-backend { } { - global cxxflags - - # Set up and preprocess a C++ test program that depends - # on tbb - set src tbb_backend[pid].cc - - set f [open $src "w"] - puts $f "#include " - close $f - set lines [v3_target_compile $src /dev/null preprocess ""] - file delete $src - - if [string match "" $lines] { - # No error message, preprocessing succeeded. - verbose "check_v3_tbb-backend: `1'" 2 - return 1 - } - verbose "check_v3_tbb-backend: `0'" 2 - return 0 + return [check_v3_target_prop_cached et_tbb { + # Set up and compile a C++ test program that depends on tbb + set src tbb_backend[pid].cc + set exe tbb_backend[pid].x + + set f [open $src "w"] + puts $f "#include " + puts $f "#if TBB_INTERFACE_VERSION < 10000" + puts $f "# error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported." + puts $f "#endif" + puts $f "int main ()" + puts $f "{" + puts $f " return 0;" + puts $f "}" + close $f + + set lines [v3_target_compile $src $exe executable "additional_flags=-std=c++17 additional_flags=-ltbb"] + file delete $src + + if [string match "" $lines] { + # No error message, compilation succeeded. + verbose "check_v3_tbb-backend: `1'" 2 + return 1 + } + verbose "check_v3_tbb-backend: `0'" 2 + return 0 + }] } set additional_prunes ""