]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use clog10 not __clog10 in tgmath.h log10 macro.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 28 Jun 2017 16:43:50 +0000 (16:43 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 28 Jun 2017 16:43:50 +0000 (16:43 +0000)
As a GNU extension, for _GNU_SOURCE glibc's complex.h provides a
clog10 function and tgmath.h supports complex arguments to the log10
macro.  However, tgmath.h uses __clog10 not clog10 in defining the
macro.

There is no namespace reason (ignoring the block-scope namespace
issues that would apply equally to *every* function called by tgmath.h
macros) for using __clog10 here, since this is only for _GNU_SOURCE so
clog10 is always visible when this macro definition is used.
Furthermore, __clog10f128 is not exported, so supporting _Float128 in
tgmath.h implies using clog10 not __clog10 there.  (__clog10 and
clog10 aren't used in libstdc++ either, although that library would
have a good case for using the __clog10 reserved-namespace export: the
standard C++ library includes log10 of a complex number.)  This patch
duly changes the header to use clog10, and enables tests of the macro
for complex arguments.

Tested for x86_64.

* math/tgmath.h [__USE_GNU] (log10): Use clog10 not __clog10.
* math/gen-tgmath-tests.py (Tests.add_all_tests): Test log10 for
complex arguments.

ChangeLog
math/gen-tgmath-tests.py
math/tgmath.h

index 1d11b9c23f5252040a49c3062cb4d661b634d565..a6fbb36ac1740151df785d143ef3411dd1ff1989 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-06-28  Joseph Myers  <joseph@codesourcery.com>
 
+       * math/tgmath.h [__USE_GNU] (log10): Use clog10 not __clog10.
+       * math/gen-tgmath-tests.py (Tests.add_all_tests): Test log10 for
+       complex arguments.
+
        [BZ #21687]
        * math/tgmath.h (__TGMATH_BINARY_REAL_RET_ONLY): New macro.
        (totalorder): Use it.
index db6553e8dcbeea3d34ffc0e1181fd63e177316c7..31a3bd2e2cf5fd652dc5b622953b13e0748f39b7 100755 (executable)
@@ -497,7 +497,9 @@ class Tests(object):
         self.add_tests('lgamma', 'r', ['r'])
         self.add_tests('llrint', 'long long int', ['r'])
         self.add_tests('llround', 'long long int', ['r'])
-        self.add_tests('log10', 'r', ['r'])
+        # log10 is real-only in ISO C, but supports complex arguments
+        # as a GNU extension.
+        self.add_tests('log10', 'g', ['g'])
         self.add_tests('log1p', 'r', ['r'])
         self.add_tests('log2', 'r', ['r'])
         self.add_tests('logb', 'r', ['r'])
index a0da1041422bb9c03b34f82083d504b970a03aee..7afe41e85969a3774be3fce366ad99ab578f025d 100644 (file)
 
 /* Base-ten logarithm of X.  */
 #ifdef __USE_GNU
-# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
+# define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, clog10)
 #else
 # define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
 #endif