From eec30733bba305b02ba3c368289ef935f17c87e6 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Sat, 6 Jul 2024 00:02:03 +0200
Subject: [PATCH] Fortran: switch test to use issignaling() built-in

The macro may not be present in all libc's, but the built-in
is always available.

gcc/testsuite/ChangeLog:

	* gfortran.dg/ieee/signaling_2.f90: Adjust test.
	* gfortran.dg/ieee/signaling_2_c.c: Adjust test.
---
 gcc/testsuite/gfortran.dg/ieee/signaling_2.f90 |  3 ---
 gcc/testsuite/gfortran.dg/ieee/signaling_2_c.c | 10 +++-------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/ieee/signaling_2.f90 b/gcc/testsuite/gfortran.dg/ieee/signaling_2.f90
index 03b04c783eb..79a85edefd1 100644
--- a/gcc/testsuite/gfortran.dg/ieee/signaling_2.f90
+++ b/gcc/testsuite/gfortran.dg/ieee/signaling_2.f90
@@ -1,9 +1,6 @@
 ! { dg-do run { target { ! ia32 } } }
 ! x87 / x86-32 ABI is unsuitable for signaling NaNs
 !
-! { dg-require-effective-target issignaling } */
-! The companion C source needs access to the issignaling macro.
-!
 ! { dg-additional-sources signaling_2_c.c }
 ! { dg-additional-options "-w" }
 ! The -w option is needed to make cc1 not report a warning for
diff --git a/gcc/testsuite/gfortran.dg/ieee/signaling_2_c.c b/gcc/testsuite/gfortran.dg/ieee/signaling_2_c.c
index ea7fc0467bd..dde09638c6f 100644
--- a/gcc/testsuite/gfortran.dg/ieee/signaling_2_c.c
+++ b/gcc/testsuite/gfortran.dg/ieee/signaling_2_c.c
@@ -1,8 +1,4 @@
-#define _GNU_SOURCE
-#include <math.h>
-#include <float.h>
-
-int isnansf (float x)       { return issignaling (x) ? 1 : 0; }
-int isnans  (double x)      { return issignaling (x) ? 1 : 0; }
-int isnansl (long double x) { return issignaling (x) ? 1 : 0; }
+int isnansf (float x)       { return __builtin_issignaling (x) ? 1 : 0; }
+int isnans  (double x)      { return __builtin_issignaling (x) ? 1 : 0; }
+int isnansl (long double x) { return __builtin_issignaling (x) ? 1 : 0; }
 
-- 
2.39.3 (Apple Git-146)

