about summary refs log tree commit diff
path: root/math/bits
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-09-15 22:12:40 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-09-15 22:12:40 +0000
commitde20571d405bfb873f63a8645f143aef2b1455a9 (patch)
treec66dd93199826738cb3d89433bacb763f451818f /math/bits
parentdfa0f62011b50cc36107df5fad4130c5368b11e1 (diff)
downloadglibc-de20571d405bfb873f63a8645f143aef2b1455a9.tar.gz
glibc-de20571d405bfb873f63a8645f143aef2b1455a9.tar.xz
glibc-de20571d405bfb873f63a8645f143aef2b1455a9.zip
Fix math.h, tgmath.h XSI POSIX namespace (gamma, isnan, scalb) (bug 18967).
math.h incorrectly declares various functions for XSI POSIX 2001 and
2008 editions.  gamma was removed in the 2001 edition but is still
declared, along with gammaf and gammal which were never standard
functions.  isnan is still declared as a function, along with isnanf
and isnanl which were never standard functions, although in 2001 the
function was replaced by the type-generic macro.  scalbf and scalbl
are declared although never standard, and scalb was removed in the
2008 edition but is still declared.  The scalb type-generic macro in
tgmath.h shouldn't be present for any POSIX version, since POSIX never
had such a type-generic macro.

This patch disables all those declarations in the relevant cases (as a
minimal fix, it leaves them enabled for __USE_MISC).  For the matter
of declaring scalb but not scalbf or scalbl for the 2001 edition, a
new macro __MATH_DECLARING_DOUBLE is added, defined by math.h around
includes of bits/mathcalls.h, for bits/mathcalls.h to use to test
which type's functions are being declared.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	[BZ #18967]
	* math/math.h (__MATH_DECLARING_DOUBLE): New macro.  Define and
	undefine around includes of <bits/mathcalls.h>.
	* math/bits/mathcalls.h [!__USE_MISC && __USE_XOPEN2K] (isnan): Do
	not declare function.
	[!__USE_MISC && __USE_XOPEN2K] (gamma): Likewise.
	[!__USE_MISC && (!__MATH_DECLARING_DOUBLE || __USE_XOPEN2K8)]
	(scalb): Likewise.
	* math/tgmath.h [!__USE_MISC && __USE_XOPEN_EXTENDED] (scalb): Do
	not define macro.
	* conform/Makefile (test-xfail-XOPEN2K/math.h/conform): Remove
	variable.
	(test-xfail-XOPEN2K/tgmath.h/conform): Likewise.
	(test-xfail-XOPEN2K8/math.h/conform): Likewise.
	(test-xfail-XOPEN2K8/tgmath.h/conform): Likewise.
Diffstat (limited to 'math/bits')
-rw-r--r--math/bits/mathcalls.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index a881b7d69c..7ffe0407e9 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -229,10 +229,12 @@ __END_NAMESPACE_C99
 /* Return nonzero if VALUE is not a number.  */
 __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
 
-#if defined __USE_MISC || defined __USE_XOPEN
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 /* Return nonzero if VALUE is not a number.  */
 __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
+#endif
 
+#if defined __USE_MISC || defined __USE_XOPEN
 /* Bessel functions.  */
 __MATHCALL (j0,, (_Mdouble_));
 __MATHCALL (j1,, (_Mdouble_));
@@ -259,7 +261,7 @@ __MATHCALL (tgamma,, (_Mdouble_));
 __END_NAMESPACE_C99
 #endif
 
-#if defined __USE_MISC || defined __USE_XOPEN
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 /* Obsolete alias for `lgamma'.  */
 __MATHCALL (gamma,, (_Mdouble_));
 #endif
@@ -366,7 +368,9 @@ __MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value))
      __attribute__ ((__const__));
 #endif
 
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
+			   && __MATH_DECLARING_DOUBLE	\
+			   && !defined __USE_XOPEN2K8)
 /* Return X times (2 to the Nth power).  */
 __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
 #endif