Replace finite() with isfinite() by default

This is part of the C standard also also causing warning on macOS.

(cherry picked from commit 04997fc0ae)
This commit is contained in:
Alex Samorukov 2019-11-07 09:09:22 +00:00 committed by Oleksii Samorukov
parent 00106b1d45
commit 2cb0493b2f
4 changed files with 27 additions and 19 deletions

View File

@ -31,10 +31,10 @@
#include "gimp-utils.h"
#if defined (HAVE_FINITE)
#define FINITE(x) finite(x)
#elif defined (HAVE_ISFINITE)
#if defined (HAVE_ISFINITE)
#define FINITE(x) isfinite(x)
#elif defined (HAVE_FINITE)
#define FINITE(x) finite(x)
#elif defined (G_OS_WIN32)
#define FINITE(x) _finite(x)
#else

View File

@ -30,10 +30,10 @@
#include "gimpcurve-map.h"
#if defined (HAVE_FINITE)
#define FINITE(x) finite(x)
#elif defined (HAVE_ISFINITE)
#if defined (HAVE_ISFINITE)
#define FINITE(x) isfinite(x)
#elif defined (HAVE_FINITE)
#define FINITE(x) finite(x)
#elif defined (G_OS_WIN32)
#define FINITE(x) _finite(x)
#else

View File

@ -1020,7 +1020,7 @@ AC_RUN_IFELSE(
[AC_MSG_RESULT])],
[AC_MSG_RESULT()])
# Check for finite or isfinite
# Check for finite
AC_CHECK_FUNCS(finite, , [
AC_MSG_CHECKING(for finite in <math.h>)
AC_LINK_IFELSE(
@ -1029,15 +1029,23 @@ AC_CHECK_FUNCS(finite, , [
[[double f = 0.0; finite (f)]])],
[AC_DEFINE(HAVE_FINITE, 1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
AC_MSG_CHECKING(for isfinite in <math.h>)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>]],
[[float f = 0.0; isfinite(f)]])],
[AC_DEFINE([HAVE_ISFINITE],[1],[Define to 1 if you have the isfinite function.])
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])])])
[AC_MSG_RESULT(no)])
]
)
# Check for isfinite
AC_CHECK_FUNCS(isfinite, , [
AC_MSG_CHECKING(for isfinite in <math.h>)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>]],
[[double f = 0.0; isfinite (f)]])],
[AC_DEFINE(HAVE_ISFINITE, 1)
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
]
)
AC_SUBST(HAVE_FINITE)
AC_SUBST(HAVE_ISFINITE)

View File

@ -2888,10 +2888,10 @@ CODE
$extra{app}->{code} = <<'CODE';
#if defined (HAVE_FINITE)
#define FINITE(x) finite(x)
#elif defined (HAVE_ISFINITE)
#if defined (HAVE_ISFINITE)
#define FINITE(x) isfinite(x)
#elif defined (HAVE_FINITE)
#define FINITE(x) finite(x)
#elif defined (G_OS_WIN32)
#define FINITE(x) _finite(x)
#else