diff lib/math.in.h @ 16631:45443deebb7d

log: Work around OSF/1 5.1 bug. * lib/math.in.h (log): New declaration. * lib/log.c: New file. * m4/log.m4 (gl_FUNC_LOG_WORKS): New macro. (gl_FUNC_LOG): Invoke it. Set REPLACE_LOG. * m4/math_h.m4 (gl_MATH_H): Test whether log is declared. (gl_MATH_H_DEFAULTS): Initialize GNULIB_LOG, REPLACE_LOG. * modules/math (Makefile.am): Substitute GNULIB_LOG, REPLACE_LOG. * modules/log (Files): Add lib/log.c. (Depends-on): Add math. (configure.ac): If REPLACE_LOG is 1, compile an override. * tests/test-math-c++.cc: Check the declaration of log. * doc/posix-functions/log.texi: Mention the OSF/1 5.1 problem.
author Bruno Haible <bruno@clisp.org>
date Fri, 09 Mar 2012 23:55:13 +0100 (2012-03-09)
parents d19d163c1519
children 2450f24b2cbc
line wrap: on
line diff
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1136,6 +1136,26 @@
 # endif
 #endif
 
+#if @GNULIB_LOG@
+# if @REPLACE_LOG@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef log
+#   define log rpl_log
+#  endif
+_GL_FUNCDECL_RPL (log, double, (double x));
+_GL_CXXALIAS_RPL (log, double, (double x));
+# else
+_GL_CXXALIAS_SYS (log, double, (double x));
+# endif
+_GL_CXXALIASWARN (log);
+#elif defined GNULIB_POSIXCHECK
+# undef log
+# if HAVE_RAW_DECL_LOG
+_GL_WARN_ON_USE (log, "log has portability problems - "
+                 "use gnulib module log for portability");
+# endif
+#endif
+
 #if @GNULIB_LOGL@
 # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
 #  undef logl