Discussion:
[PATCH] Fix gnulib C++ namespace support and std::frexp
(too old to reply)
Pedro Alves
2016-11-12 16:22:53 UTC
Permalink
Raw Message
frexp is an overloaded function in C++. Use _GL_CXXALIASWARN1 to
explicitly pick the overload being replaced.

Otherwise, with e.g. GCC 7, if you enable gnulib's namespace support,
you'll see:

In file included from .../src/gdb/common/common-defs.h:54:0,
from .../src/gdb/defs.h:28,
from .../src/gdb/score-tdep.c:24:
build-gnulib/import/math.h:1326:1: error: type of ‘std::frexp’ is unknown
_GL_CXXALIASWARN (frexp);
^
build-gnulib/import/math.h:1326:1: error: ‘int frexp’ redeclared as different kind of symbol
_GL_CXXALIASWARN (frexp);
^
In file included from /opt/gcc/include/c++/7.0.0/math.h:36:0,
from build-gnulib/import/math.h:27,
from .../src/gdb/score-tdep.h:26,
from .../src/gdb/score-tdep.c:38:
/opt/gcc/include/c++/7.0.0/cmath:300:3: note: previous declaration ‘float std::frexp(float, int*)’
frexp(float __x, int* __exp)
^~~~~

ChangeLog:
2016-11-12 Pedro Alves <***@redhat.com>

Fix gnulib C++ namespace support and std::frexp
* lib/math.in.h (frexp): Use _GL_CXXALIASWARN1 instead of
_GL_CXXALIASWARN.
---
lib/math.in.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/math.in.h b/lib/math.in.h
index b7a0029..9a194cb 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -983,7 +983,7 @@ _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
-_GL_CXXALIASWARN (frexp);
+_GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
--
2.5.5
Bruno Haible
2016-11-20 01:10:33 UTC
Permalink
Raw Message
Post by Pedro Alves
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -983,7 +983,7 @@ _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
# else
_GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
# endif
-_GL_CXXALIASWARN (frexp);
+_GL_CXXALIASWARN1 (frexp, double, (double x, int *expptr));
#elif defined GNULIB_POSIXCHECK
# undef frexp
/* Assume frexp is always declared. */
Thank you. It's evidently correct.

Bruno

Loading...