public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Yaakov Selkowitz <yselkowitz@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] math: guard BSD finite/isinf/isnan functions properly in math.h
Date: Mon, 04 Apr 2016 20:07:00 -0000	[thread overview]
Message-ID: <20160404200707.23179.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=722e363c4de410e67f24d0da3129c446074716bc

commit 722e363c4de410e67f24d0da3129c446074716bc
Author: Yaakov Selkowitz <yselkowi@redhat.com>
Date:   Mon Apr 4 14:13:21 2016 -0500

    math: guard BSD finite/isinf/isnan functions properly in math.h
    
    Now that we have properly functioning feature test macros, the BSD
    floating-point classification functions can go into math.h instead of
    the non-standard ieeefp.h, and not under the C99 guard:
    
    http://man7.org/linux/man-pages/man3/finite.3.html
    
    The isnan function was in earlier versions of SUS but removed starting with
    POSIX.1-2001, compare:
    
    http://pubs.opengroup.org/onlinepubs/007908799/xsh/math.h.html
    http://pubs.opengroup.org/onlinepubs/009695399/basedefs/math.h.html
    
    Note that the isinf and isnan functions (but not the variants) conflict
    with functions by the same name in C++11, hence they (and only they)
    need to be hidden:
    
    https://sourceware.org/git/?p=glibc.git;a=commit;h=d9b965fa56350d6eea9f7f438a0714c7ffbb183f
    https://sourceware.org/git/?p=glibc.git;a=commit;h=3c47c83a9730c20e602694505b9278c25637b0d0
    
    Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

Diff:
---
 newlib/libc/include/ieeefp.h | 13 -------------
 newlib/libc/include/math.h   | 25 +++++++++++++++++++------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/newlib/libc/include/ieeefp.h b/newlib/libc/include/ieeefp.h
index 2ffa456..2c04284 100644
--- a/newlib/libc/include/ieeefp.h
+++ b/newlib/libc/include/ieeefp.h
@@ -241,19 +241,6 @@ typedef int fp_rdi;
 fp_rdi _EXFUN(fpgetroundtoi,(void));
 fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi));
 
-#undef isnan
-#undef isinf
-
-int _EXFUN(isnan, (double));
-int _EXFUN(isinf, (double));
-int _EXFUN(finite, (double));
-
-
-
-int _EXFUN(isnanf, (float));
-int _EXFUN(isinff, (float));
-int _EXFUN(finitef, (float));
-
 #define __IEEE_DBL_EXPBIAS 1023
 #define __IEEE_FLT_EXPBIAS 127
 
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index e5d6123..798fc6d 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -137,6 +137,25 @@ extern double fmod _PARAMS((double, double));
 #endif /* ! defined (__math_68881) */
 #endif /* ! defined (_REENT_ONLY) */
 
+#if __MISC_VISIBLE
+extern int finite _PARAMS((double));
+extern int finitef _PARAMS((float));
+extern int finitel _PARAMS((long double));
+extern int isinff _PARAMS((float));
+extern int isnanf _PARAMS((float));
+#ifdef __CYGWIN__ /* not implemented in newlib yet */
+extern int isinfl _PARAMS((long double));
+extern int isnanl _PARAMS((long double));
+#endif
+#if !defined(__cplusplus) || __cplusplus < 201103L
+extern int isinf _PARAMS((double));
+#endif
+#endif /* __MISC_VISIBLE */
+#if (__MISC_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)) \
+  && (!defined(__cplusplus) || __cplusplus < 201103L)
+extern int isnan _PARAMS((double));
+#endif
+
 #if __ISO_C_VISIBLE >= 1999
 /* ISO C99 types and macros. */
 
@@ -289,15 +308,10 @@ extern int __signbitd (double x);
                            fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
 #endif
 
-/* Non ANSI long double precision functions.  */
-
-extern int finitel _PARAMS((long double));
-
 /* Non ANSI double precision functions.  */
 
 extern double infinity _PARAMS((void));
 extern double nan _PARAMS((const char *));
-extern int finite _PARAMS((double));
 extern double copysign _PARAMS((double, double));
 extern double logb _PARAMS((double));
 extern int ilogb _PARAMS((double));
@@ -396,7 +410,6 @@ extern float fmaf _PARAMS((float, float, float));
 
 extern float infinityf _PARAMS((void));
 extern float nanf _PARAMS((const char *));
-extern int finitef _PARAMS((float));
 extern float copysignf _PARAMS((float, float));
 extern float logbf _PARAMS((float));
 extern int ilogbf _PARAMS((float));


                 reply	other threads:[~2016-04-04 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160404200707.23179.qmail@sourceware.org \
    --to=yselkowitz@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).