about summary refs log tree commit diff
path: root/math/bits/math-finite.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Fix finite-math-only lgamma functions signgam setting (bug 19211).Joseph Myers2015-11-051-24/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lgamma inline functions in bits/math-finite.h do not set signgam if __USE_ISOC99, even when other feature test macros mean a standard such as XSI POSIX is selected for which it should be set. (This is essentially the opposite issue to bug 15421, the out-of-line versions setting signgam even when they shouldn't.) This patch fixes those functions to use __USE_MISC || __USE_XOPEN as the condition for when to set signgam, since it's the condition for when math.h declares signgam. The legacy gamma* names are only declared at all if __USE_MISC || __USE_XOPEN, so they just set signgam unconditionally. Tests for certain standards or not using _GNU_SOURCE cannot use test-skeleton.c (this is a known issue noted on the wiki todo list). Thus, the new tests that signgam remains not set in ISO C modes do not use test-skeleton.c. They also define _ISOMAC to avoid running into declarations in the internal include/ headers that only work in _GNU_SOURCE mode. Tested for x86_64 and x86. [BZ #19211] * math/bits/math-finite.h (lgamma): Set signgam if [__USE_MISC || __USE_XOPEN], not if [!__USE_ISOC99]. (lgammaf): Likewise. (lgammal): Likewise. (gamma): Set signgam unconditionally, not if [!__USE_ISOC99]. (gammaf): Likewise. (gammal): Likewise. * math/test-signgam-finite-c11.c: New file. * math/test-signgam-finite-c99.c: Likewise. * math/test-signgam-finite.c: Likewise. * math/Makefile (tests): Add test-signgam-finite, test-signgam-finite-c99 and test-signgam-finite-c11. (CFLAGS-test-signgam-finite.c): New variable. (CFLAGS-test-signgam-finite-c99.c): Likewise. (CFLAGS-test-signgam-finite-c11.c): Likewise.
* Don't redirect ldexp to scalbn in bits/math-finite.h (bug 19209).Joseph Myers2015-11-051-9/+0
| | | | | | | | | | | | | | | | | bits/math-finite.h maps ldexp functions to corresponding scalbn functions. This is (a) a namespace bug for C90, which has ldexp but not scalbn, and (b) in any case useless, since the ldexp and scalbn functions have identical semantics (for floating-point types with radix 2), and since the fix for bug 6803 are actually aliases (presumably the mapping was based around the old bug of scalbn not setting errno). This patch removes the bogus redirections. Tested for x86_64 and x86. [BZ #19209] * math/bits/math-finite.h (ldexp): Remove declaration. (ldexpf): Likewise. (ldexpl): Likewise.
* Make bits/math-finite.h conditions match other headers (bug 19205).Joseph Myers2015-11-051-62/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bits/math-finite.h declares -ffinite-math-only variants of various functions under conditions not matching those under which the normal versions are declared. * math.h only ever includes bits/mathcalls.h to declare float and long double functions if __USE_ISOC99, but bits/math-finite.h declares some float functions regardless (long double ones are conditioned on __MATH_DECLARE_LDOUBLE). (For C90 functions this isn't a conformance bug because C90 reserves the float and long double names, but is still contrary to good glibc practice. For some other functions in older XSI standards it *is* a conformance bug.) * Some functions are defined as inlines using lgamma_r functions under conditions where those lgamma_r functions are not themselves declared. * hypot is declared under __USE_XOPEN || __USE_ISOC99 in bits/mathcalls.h, __USE_ISOC99 only in bits/math-finite.h. * float and long double versions of Bessel functions should be limited to __USE_MISC (as in bug 18977). * gamma should not be declared for __USE_XOPEN2K (as in bug 18967). * remainder should be restricted to __USE_XOPEN_EXTENDED || __USE_ISOC99, not unconditional. * scalb should not be declared for __USE_XOPEN2K8, and scalbf and scalbl are non-POSIX (as in bug 18967). This patch fixes all these issues (it doesn't seem worth splitting them into separate patches or bugs). I put __USE_ISOC99 conditionals, where needed, around both float and long double declarations, even though formally redundant around the long double declarations because __MATH_DECLARE_LDOUBLE isn't defined without __USE_ISOC99; it seemed clearer that way. The missing declarations of lgamma_r functions are dealt with by directly using declarations of __lgamma*_r_finite, in the implementation namespace, rather than having the inlines rely on asm redirection of lgamma*_r. After this patch, there are some apparently redundant nested __USE_ISOC99 conditionals in lgamma / gamma definitions. These actually reflect a separate bug (the correct condition for the lgamma inline functions to set signgam is __USE_MISC || __USE_XOPEN, the condition under which signgam is declared, rather than disabling setting it if __USE_ISOC99, which includes XSI POSIX versions for which signgam *should* be set). They'll be fixed as part of a fix for that bug, which will also add tests for these inlines. I've put a note about more general conform/ test coverage for -ffinite-math-only on <https://sourceware.org/glibc/wiki/Development_Todo/Master#conformtest_improvements>, alongside other options for which this is also relevant (some of which have also had such bugs in the past relating to mismatched conditionals). I also intend to enable the main libm-test.inc tests for the math-finite.h functions, but some other bugs in __*_finite need fixing first. [BZ #19205] * math/bits/math-finite.h (acosf): Condition declaration on [__USE_ISOC99]. (acosl): Likewise. (acoshf): Likewise. (acoshl): Likewise. (asinf): Likewise. (asinl): Likewise. (atan2f): Likewise. (atan2l): Likewise. (atanhf): Likewise. (atanhl): Likewise. (coshf): Likewise. (coshl): Likewise. (expf): Likewise. (expl): Likewise. (fmodf): Likewise. (fmodl): Likewise. (hypot): Change condition to [__USE_XOPEN || __USE_ISOC99]. (j0f): Change condition to [__USE_MISC && __USE_ISOC99]. (j0l): Likewise. (y0f): Likewise. (y0l): Likewise. (j1f): Likewise. (j1l): Likewise. (y1f): Likewise. (y1l): Likewise. (jnf): Likewise. (jnl): Likewise. (ynf): Likewise. (ynl): Likewise. (lgammaf_r): Condition declaration on [__USE_ISOC99]. (lgammal_r): Likewise. (__lgamma_r_finite): New declaration. (__lgammaf_r_finite): Likewise. (__lgammal_r_finite): Likewise. (lgamma): Use __lgamma_r_finite. (lgammaf): Condition definition on [__USE_ISOC99]. Use __lgammaf_r_finite. (lgammal): Condition definition on [__USE_ISOC99]. Use __lgammal_r_finite. (gamma): Do not define for [!__USE_MISC && __USE_XOPEN2K]. Use __lgamma_r_finite. (gammaf): Condition definition on [__USE_ISOC99]. Use __lgammaf_r_finite. (gammal): Condition definition on [__USE_ISOC99]. Use __lgammal_r_finite. (logf): Condition declaration on [__USE_ISOC99]. (logl): Likewise. (log10f): Likewise. (log10l): Likewise. (ldexpf): Likewise. (ldexpl): Likewise. (powf): Likewise. (powl): Likewise. (remainder): Condition declaration on [__USE_XOPEN_EXTENDED || __USE_ISOC99]. (remainderf): Condition declaration on [__USE_ISOC99]. (remainderl): Likewise. (scalb): Do not declare for [!__USE_MISC && __USE_XOPEN2K8]. (scalbf): Change condition to [__USE_MISC && __USE_ISOC99]. (scalbl): Likewise. (sinhf): Condition declaration on [__USE_ISOC99]. (sinhl): Likewise. (sqrtf): Likewise. (sqrtl): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Revert to defining __extern_inline only for gcc-4.3+ (BZ #17266)Siddhesh Poyarekar2014-09-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The check for only __GNUC_STDC_INLINE__ and __GNUC_GNU_INLINE__ may not be sufficient since those flags were added during initial support for C99 inlining semantics. There is also a problem with always defining __extern_inline and __extern_always_inline, since it enables inline wrapper functions even when GNU inlining semantics are not guaranteed. This, along with the possibility of such wrappers using redirection (btowc for example) could result in compiler generating an infinitely recusrive call to the function. In fact it was such a recursion that led to this code being written the way it was; see: https://bugzilla.redhat.com/show_bug.cgi?id=186410 The initial change was to fix bugs 14530 and 13741, but they can be resolved by checking if __fortify_function and/or __extern_always_inline are defined, as it has been done in this patch. In addition, I have audited uses of __extern_always_inline to make sure that none of the uses result in compilation errors. There is however a regression in this patch for llvm, since it reverts the llvm expectation that __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE__ definition imply proper extern inline semantics. 2014-09-16 Siddhesh Poyarekar <siddhesh@redhat.com> Jakub Jelinek <jakub@redhat.com> [BZ #17266] * libio/stdio.h: Check definition of __fortify_function instead of __extern_always_inline to include bits/stdio2.h. * math/bits/math-finite.h [__USE_XOPEN || __USE_ISOC99]: Also check if __extern_always_inline is defined. [__USE_MISC || __USE_XOPEN]: Likewise. [__USE_ISOC99] Likewise. * misc/sys/cdefs.h (__fortify_function): Define only if __extern_always_inline is defined. [!__cplusplus || __GNUC_PREREQ (4,3)]: Revert to defining __extern_always_inline and __extern_inline only for g++-4.3 and newer or a compatible gcc.
* Complete _BSD_SOURCE / _SVID_source followup cleanup.Joseph Myers2014-02-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the headers cleanup consequent on removal of _BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations): * #endif conditionals that referred to BSD or SVID are updated. * Redundant __USE_* tests in cases involving __USE_MISC are removed. This includes cases such as __USE_MISC || __USE_ISOC99, where __USE_MISC is redundant (because __USE_MISC is only ever defined in the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99 is also defined; the same applies to the non-XSI-extended POSIX versions), and cases involving __USE_GNU, where __USE_GNU is redundant (because if __USE_GNU is defined, so are the other __USE_* macros). There may well be other cases of __USE_FOO || __USE_BAR tests that could be simplified because one macro implies the other; this patch only addresses cases involving __USE_MISC. Tested x86_64. * bits/fcntl.h [__USE_MISC]: Remove redundant conditionals. * bits/sigaction.h [__USE_MISC]: Likewise. * bits/waitstatus.h: Update #endif comments. * ctype/ctype.h: Likewise. * dirent/dirent.h: Likewise. [__USE_MISC]: Remove redundant conditionals. * grp/grp.h: Update #endif comments. [__USE_GNU]: Remove redundant conditionals. [__USE_MISC]: Likewise. * inet/netinet/in.h [__USE_GNU]: Likewise. * io/sys/stat.h [__USE_MISC]: Likewise. * libio/bits/stdio-ldbl.h [__USE_MISC]: Likewise. * libio/bits/stdio.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * libio/bits/stdio2.h [__USE_MISC]: Likewise. * libio/stdio.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * math/bits/math-finite.h [__USE_MISC]: Likewise. * math/bits/mathcalls.h [__USE_MISC]: Likewise. * math/math.h: Update #else and #endif comments. [__USE_MISC]: Remove redundant conditionals. * misc/sys/uio.h: Update #endif comments. * posix/bits/unistd.h [__USE_MISC]: Remove redundant conditionals. * posix/glob.h [__USE_MISC]: Likewise. * posix/sys/types.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * posix/sys/wait.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * posix/unistd.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * pwd/pwd.h [__USE_GNU]: Likewise. [__USE_MISC]: Likewise. * resolv/netdb.h [__USE_GNU]: Likewise. * signal/signal.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * stdlib/stdlib.h: Update #else and #endif comments. [__USE_MISC]: Remove redundant conditionals. [__USE_GNU]: Likewise. * string/bits/string2.h [__USE_MISC]: Likewise. * string/string.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__USE_MISC]: Likewise. * sysdeps/mach/hurd/bits/fcntl.h [__USE_MISC]: Likewise. * sysdeps/mach/hurd/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * sysdeps/unix/sysv/linux/bits/in.h [__USE_GNU]: Likewise. * sysdeps/unix/sysv/linux/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/bits/socket.h [__USE_GNU]: Likewise. * sysdeps/unix/sysv/linux/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/m68k/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/mips/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/s390/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/s390/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/x86/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/x86/bits/string.h: Update #endif comments. * sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC]: Remove redundant conditionals. * time/sys/time.h: Update #endif comments. * time/time.h: Likewise. [__USE_MISC]: Remove redundant conditionals.
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Don't use long double *_finite functions if no long double mathAndreas Schwab2012-04-281-0/+119
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Optimize ldexp and scalbnUlrich Drepper2012-01-101-1/+8
|
* Avoid warnings in __*_finite math function declarations with C++Marek Polacek2011-12-171-90/+97
|
* Optimize expUlrich Drepper2011-10-151-0/+7
| | | | Add __exp*_finite optimizations and rewrite some wrappers.
* Optimize libmUlrich Drepper2011-10-121-0/+315
libm is now somewhat integrated with gcc's -ffinite-math-only option and lots of the wrapper functions have been optimized.