PR libstdc++/90252 fix effective-target check for TBB
authorJonathan Wakely <jwakely@redhat.com>
Tue, 21 May 2019 13:50:41 +0000 (14:50 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 21 May 2019 13:50:41 +0000 (14:50 +0100)
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.

From-SVN: r271466

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

index 90708f980255a9366ad4299c3479ce0ac091b2c1..804bace5e032dc784886d5fd81b4631fd965275b 100644 (file)
@@ -1,5 +1,10 @@
 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.
+
        * doc/xml/manual/shared_ptr.xml: Fix names of lock policy constants.
 
 2019-05-20  Thomas Rodgers  <trodgers@redhat.com>
index 26f3d46e08910f0c85292aa18d7d1fa26c970f91..868a7cf7aeceb1795fc1f7ad9e16b0ade1e861fe 100644 (file)
@@ -1581,34 +1581,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 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 "-ltbb"]
-    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 ""