re PR testsuite/25891 (gomp tests run on non-libgomp (non-thread) ports, failing...
authorHans-Peter Nilsson <hp@axis.com>
Mon, 23 Jan 2006 23:44:16 +0000 (23:44 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Mon, 23 Jan 2006 23:44:16 +0000 (23:44 +0000)
PR testsuite/25891
* lib/target-supports.exp (check_effective_target_fopenmp): New proc.
* gcc.dg/gomp/gomp.exp: Return without testing anything if
check_effective_target_fopenmp returns 0.

From-SVN: r110148

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/gomp.exp
gcc/testsuite/lib/target-supports.exp

index 954772f..aa0ed47 100644 (file)
@@ -1,3 +1,10 @@
+2006-01-24  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR testsuite/25891
+       * lib/target-supports.exp (check_effective_target_fopenmp): New proc.
+       * gcc.dg/gomp/gomp.exp: Return without testing anything if
+       check_effective_target_fopenmp returns 0.
+
 2006-01-23  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR ada/20548
index cb1b338..7ce426d 100644 (file)
@@ -3,6 +3,10 @@
 # Load support procs.
 load_lib gcc-dg.exp
 
+if ![check_effective_target_fopenmp] {
+  return
+}
+
 # Initialize `dg'.
 dg-init
 
index 05a180e..851218f 100644 (file)
@@ -468,6 +468,41 @@ proc check_effective_target_tls_runtime {} {
     return $et_tls_runtime_saved
 }
 
+# Return 1 if compilation with -fopenmp is error-free for trivial
+# code, 0 otherwise.
+
+proc check_effective_target_fopenmp {} {
+    global et_fopenmp_saved
+    global et_fopenmp_target_name
+
+    if { ![info exists et_fopenmp_target_name] } {
+       set et_fopenmp_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_fopenmp_target_name } {
+       verbose "check_effective_target_fopenmp: `$et_fopenmp_target_name'" 2
+       set et_fopenmp_target_name $current_target
+       if [info exists et_fopenmp_saved] {
+           verbose "check_effective_target_fopenmp: removing cached result" 2
+           unset et_fopenmp_saved
+       }
+    }
+
+    if [info exists et_fopenmp_saved] {
+       verbose "check_effective_target_fopenmp: using cached result" 2
+    } else {
+       verbose "check_effective_target_fopenmp: compiling source" 2
+
+       set et_fopenmp_saved [string match "" [get_compiler_messages fopenmp object {
+           void foo (void) { }
+       } "-fopenmp"]]
+    }
+    verbose "check_effective_target_fopenmp: returning $et_fopenmp_saved" 2
+    return $et_fopenmp_saved
+}
+
 # Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
 # emitted, 0 otherwise.  Whether a shared library can actually be built is
 # out of scope for this test.