I recently wanted to use { dg-require-effective-target fenv } in a
libstdc++ test, but it uses -std=gnu99 which is only valid for C.

This allows C++ tests to use the fenv and fenv_exceptions
effective-target keywords.

gcc/testsuite/ChangeLog:

        * lib/target-supports.exp (check_effective_target_fenv): Use
        -std=gnu++11 instead of -std=gnu99 for C++ tests.
        (check_effective_target_fenv_exceptions): Likewise.


I don't actually need to use the 'fenv' target now, but does this seem
like a reasonable change anyway?


commit 727a3c3008038f97b0d43ebd88b2da6b4d4159f6
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Jul 30 10:32:03 2020

    testsuite: Enable fenv effective-targets for C++
    
    I recently wanted to use { dg-require-effective-target fenv } in a
    libstdc++ test, but it uses -std=gnu99 which is only valid for C.
    
    This allows C++ tests to use the fenv and fenv_exceptions
    effective-target keywords.
    
    gcc/testsuite/ChangeLog:
    
            * lib/target-supports.exp (check_effective_target_fenv): Use
            -std=gnu++11 instead of -std=gnu99 for C++ tests.
            (check_effective_target_fenv_exceptions): Likewise.

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 57eed3012b9..042334e3a35 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9533,9 +9533,14 @@ proc check_effective_target_avr_tiny { } {
 # Return 1 if <fenv.h> is available.
 
 proc check_effective_target_fenv {} {
+    if [check_effective_target_c++] {
+	set std "-std=gnu++11"
+    } else {
+	set std "-std=gnu99"
+    }
     return [check_no_compiler_messages fenv object {
 	#include <fenv.h>
-    } [add_options_for_ieee "-std=gnu99"]]
+    } [add_options_for_ieee "$std"]]
 }
 
 # Return 1 if <fenv.h> is available with all the standard IEEE
@@ -9544,6 +9549,11 @@ proc check_effective_target_fenv {} {
 # exceptions, those need to be specified in the testcases.)
 
 proc check_effective_target_fenv_exceptions {} {
+    if [check_effective_target_c++] {
+	set std "-std=gnu++11"
+    } else {
+	set std "-std=gnu99"
+    }
     return [check_runtime fenv_exceptions {
 	#include <fenv.h>
 	#include <stdlib.h>
@@ -9572,7 +9582,7 @@ proc check_effective_target_fenv_exceptions {} {
 	  else
 	    abort ();
 	}
-    } [add_options_for_ieee "-std=gnu99"]]
+    } [add_options_for_ieee "$std"]]
 }
 
 # Return 1 if -fexceptions is supported.

Reply via email to