summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-05-23 21:17:22 +0200
committerBruno Haible <bruno@clisp.org>2020-05-23 21:17:22 +0200
commit665e4118cbfc611e1e9b1767f0817a5903e29e8b (patch)
tree123fed9d199763e779bb03c891014ecac875bc6c /m4
parent3cf2dc197941c8a162c338de008450a95a5bcc38 (diff)
downloadgnulib-665e4118cbfc611e1e9b1767f0817a5903e29e8b.tar.gz
isnanf, isnanl, isnan: Don't use nonexistent builtins with clang.
* m4/isnanf.m4 (gl_HAVE_ISNANF_NO_LIBM, gl_HAVE_ISNANF_IN_LIBM, gl_ISNANF_WORKS): Don't use __builtin_isnanf on clang versions that don't have it. * m4/isnanl.m4 (gl_HAVE_ISNANL_NO_LIBM, gl_HAVE_ISNANL_IN_LIBM, gl_FUNC_ISNANL_WORKS): Don't use __builtin_isnanl on clang versions that don't have it. * lib/isnanf-nolibm.h (__has_builtin): New macro. (isnanf): Don't use __builtin_isnanf on clang versions that don't have it. * lib/isnanl-nolibm.h (__has_builtin): New macro. (isnanl): Don't use __builtin_isnanl on clang versions that don't have it. * lib/math.in.h (__has_builtin): New macro. (isnanf): Don't use __builtin_isnanf on clang versions that don't have it. (isnanl): Don't use __builtin_isnanl on clang versions that don't have it. (isnan): Don't use the builtins on clang versions that don't have __builtin_isnanf and __builtin_isnanl.
Diffstat (limited to 'm4')
-rw-r--r--m4/isnanf.m417
-rw-r--r--m4/isnanl.m417
2 files changed, 26 insertions, 8 deletions
diff --git a/m4/isnanf.m4 b/m4/isnanf.m4
index 4e9fb48652..7dd67bd8b4 100644
--- a/m4/isnanf.m4
+++ b/m4/isnanf.m4
@@ -1,4 +1,4 @@
-# isnanf.m4 serial 15
+# isnanf.m4 serial 16
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -74,7 +74,10 @@ AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
- #if __GNUC__ >= 4
+ #ifndef __has_builtin
+ # define __has_builtin(name) 0
+ #endif
+ #if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanf))
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
#elif defined isnan
@@ -99,7 +102,10 @@ AC_DEFUN([gl_HAVE_ISNANF_IN_LIBM],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
- #if __GNUC__ >= 4
+ #ifndef __has_builtin
+ # define __has_builtin(name) 0
+ #endif
+ #if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanf))
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
#elif defined isnan
@@ -127,7 +133,10 @@ AC_DEFUN([gl_ISNANF_WORKS],
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <math.h>
-#if __GNUC__ >= 4
+#ifndef __has_builtin
+# define __has_builtin(name) 0
+#endif
+#if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanf))
# undef isnanf
# define isnanf(x) __builtin_isnanf ((float)(x))
#elif defined isnan
diff --git a/m4/isnanl.m4 b/m4/isnanl.m4
index 9874418a69..75d5462975 100644
--- a/m4/isnanl.m4
+++ b/m4/isnanl.m4
@@ -1,4 +1,4 @@
-# isnanl.m4 serial 20
+# isnanl.m4 serial 21
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -68,7 +68,10 @@ AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
- #if __GNUC__ >= 4
+ #ifndef __has_builtin
+ # define __has_builtin(name) 0
+ #endif
+ #if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
@@ -93,7 +96,10 @@ AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>
- #if __GNUC__ >= 4
+ #ifndef __has_builtin
+ # define __has_builtin(name) 0
+ #endif
+ #if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan
@@ -123,7 +129,10 @@ AC_DEFUN([gl_FUNC_ISNANL_WORKS],
#include <float.h>
#include <limits.h>
#include <math.h>
-#if __GNUC__ >= 4
+#ifndef __has_builtin
+# define __has_builtin(name) 0
+#endif
+#if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl))
# undef isnanl
# define isnanl(x) __builtin_isnanl ((long double)(x))
#elif defined isnan