On AIX 7.2 with xlclang in 64-bit mode I see this compilation error:

xlclang -q64 -qthreaded -qtls -std=gnu11 -DHAVE_CONFIG_H -I. -I../../gllib -I.. 
 -DGNULIB_STRICT_CHECKING=1  -I/home/haible/prefix64/include -D_THREAD_SAFE  -g 
-O2 -MT math.o -MD -MP -MF .deps/math.Tpo -c -o math.o ../../gllib/math.c
In file included from ../../gllib/math.c:3:
./math.h:1832:19: error: function cannot return function type 'int (long 
double)'
_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
                  ^
1 error generated.

The reason is that in this situation, 'ilogbl' is defined as a macro.
This patch fixes it.


2021-01-06  Bruno Haible  <[email protected]>

        ilogbl: Fix compilation error with xlclang on AIX 7.2.
        * lib/math.in.h (ilogbl): Undefine macro before declaration.

diff --git a/lib/math.in.h b/lib/math.in.h
index 6208a01..335505d 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1322,6 +1322,7 @@ _GL_FUNCDECL_RPL (ilogbl, int, (long double x));
 _GL_CXXALIAS_RPL (ilogbl, int, (long double x));
 # else
 #  if !@HAVE_ILOGBL@
+#   undef ilogbl
 _GL_FUNCDECL_SYS (ilogbl, int, (long double x));
 #  endif
 _GL_CXXALIAS_SYS (ilogbl, int, (long double x));
@@ -2102,7 +2103,7 @@ _GL_FUNCDECL_RPL (sinf, float, (float x));
 _GL_CXXALIAS_RPL (sinf, float, (float x));
 # else
 #  if !@HAVE_SINF@
- #  undef sinf
+#   undef sinf
 _GL_FUNCDECL_SYS (sinf, float, (float x));
 #  endif
 _GL_CXXALIAS_SYS (sinf, float, (float x));


Reply via email to