]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR libstdc++/90252 Check TBB version and ability to link with -ltbb
authorJonathan Wakely <jwakely@redhat.com>
Fri, 14 Jun 2019 18:10:52 +0000 (19:10 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 14 Jun 2019 18:10:52 +0000 (19:10 +0100)
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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/lib/libstdc++.exp

index 55473574a14ea59bad64a9214d6c5e1b4173583f..2844d7701ddf728ba6d880101593cf8c9af63aac 100644 (file)
@@ -1,3 +1,27 @@
+2019-06-14  Jonathan Wakely  <jwakely@redhat.com>
+
+       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
index d0efc90a1baa391737d29b38f6067d6a5ecbf8b7..1ab896d3deb3bbba4b2d5ac0b607821e0173b091 100644 (file)
@@ -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 ""