[gcc/devel/omp/gcc-9] PR libstdc++/90252 Check TBB version and ability to link with -ltbb

Tobias Burnus burnus@gcc.gnu.org
Thu Mar 5 13:59:00 GMT 2020


https://gcc.gnu.org/g:11441586ef812e0cdcd535e19f9953ba30ccbf4a

commit 11441586ef812e0cdcd535e19f9953ba30ccbf4a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jun 14 19:10:52 2019 +0100

    PR libstdc++/90252 Check TBB version and ability to link with -ltbb
    
    Backport from mainline
    2019-05-21  Jonathan Wakely  <jwakely@redhat.com>
    
    	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  <trodgers@redhat.com>
    
    	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  <trodgers@redhat.com>
    
    	* testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend):
    	Add check for Thread Building Blocks 2018 or later.
    
    From-SVN: r272298

Diff:
---
 libstdc++-v3/ChangeLog                   | 24 +++++++++++++++++
 libstdc++-v3/testsuite/lib/libstdc++.exp | 46 +++++++++++++++++++-------------
 2 files changed, 51 insertions(+), 19 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5547357..2844d77 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -3,6 +3,30 @@
 	Backport from mainline
 	2019-05-21  Jonathan Wakely  <jwakely@redhat.com>
 
+	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  <trodgers@redhat.com>
+
+	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  <trodgers@redhat.com>
+
+	* testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend):
+	Add check for Thread Building Blocks 2018 or later.
+
+2019-06-14  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backport from mainline
+	2019-05-21  Jonathan Wakely  <jwakely@redhat.com>
+
 	* doc/xml/manual/shared_ptr.xml: Fix names of lock policy constants.
 
 2019-06-11  Edward Smith-Rowland  <3dw4rd@verizon.net>
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index d0efc90..1ab896d 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 <tbb/tbb.h>"
-		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 <tbb/tbb.h>"
+        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 ""



More information about the Libstdc++-cvs mailing list