]> Savannah Git Hosting - gnulib.git/commitdiff
sinhf: Avoid redefinition error on MSVC.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 19:41:36 +0000 (20:41 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Dec 2016 22:09:16 +0000 (23:09 +0100)
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_SINHF.
* m4/sinhf.m4 (gl_FUNC_SINHF): Set REPLACE_SINHF to 1 if the function
may be defined as an inline function.
* modules/math (Makefile.am): Substitute REPLACE_SINHF.
* lib/math.in.h (sinhf): Override if REPLACE_SINHF is 1.

ChangeLog
lib/math.in.h
m4/math_h.m4
m4/sinhf.m4
modules/math

index fd9cba0712c7914c7002dbd9e4200d4e17579767..55393eb1023a439d18336ac4fc3326d1a276dd2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-12-17  Bruno Haible  <bruno@clisp.org>
+
+       sinhf: Avoid redefinition error on MSVC.
+       * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_SINHF.
+       * m4/sinhf.m4 (gl_FUNC_SINHF): Set REPLACE_SINHF to 1 if the function
+       may be defined as an inline function.
+       * modules/math (Makefile.am): Substitute REPLACE_SINHF.
+       * lib/math.in.h (sinhf): Override if REPLACE_SINHF is 1.
+
 2016-12-17  Bruno Haible  <bruno@clisp.org>
 
        sinf: Avoid redefinition error on MSVC.
index 34730f71472eab004ee943ee4be86ce0420cf311..05aa8eafddbf5d0e78be97a46975df39e26fcda3 100644 (file)
@@ -1930,11 +1930,20 @@ _GL_WARN_ON_USE (sinl, "sinl is unportable - "
 
 
 #if @GNULIB_SINHF@
-# if !@HAVE_SINHF@
-#  undef sinhf
+# if @REPLACE_SINHF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sinhf
+#   define sinhf rpl_sinhf
+#  endif
+_GL_FUNCDECL_RPL (sinhf, float, (float x));
+_GL_CXXALIAS_RPL (sinhf, float, (float x));
+# else
+#  if !@HAVE_SINHF@
+#   undef sinhf
 _GL_FUNCDECL_SYS (sinhf, float, (float x));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (sinhf, float, (float x));
+# endif
 _GL_CXXALIASWARN (sinhf);
 #elif defined GNULIB_POSIXCHECK
 # undef sinhf
index 538a65008c9540f33d86c9fc444c66e86012773b..eac869209f8759709f3a30895a8086a28be6c6ae 100644 (file)
@@ -323,6 +323,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   REPLACE_SIGNBIT=0;           AC_SUBST([REPLACE_SIGNBIT])
   REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
   REPLACE_SINF=0;              AC_SUBST([REPLACE_SINF])
+  REPLACE_SINHF=0;             AC_SUBST([REPLACE_SINHF])
   REPLACE_SQRTL=0;             AC_SUBST([REPLACE_SQRTL])
   REPLACE_TRUNC=0;             AC_SUBST([REPLACE_TRUNC])
   REPLACE_TRUNCF=0;            AC_SUBST([REPLACE_TRUNCF])
index f20d4f9d40f22f29d9e30bea1df1ab6224c2e19e..e78d5e5c3fbfc8fa6bff718d2e160a295f3a7240 100644 (file)
@@ -1,4 +1,4 @@
-# sinhf.m4 serial 2
+# sinhf.m4 serial 3
 dnl Copyright (C) 2011-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -22,6 +22,10 @@ AC_DEFUN([gl_FUNC_SINHF],
     SINHF_LIBM="$SINH_LIBM"
   else
     HAVE_SINHF=0
+    dnl If the function is declared but does not appear to exist, it may be
+    dnl defined as an inline function. In order to avoid a conflict, we have
+    dnl to define rpl_sinhf, not sinhf.
+    AC_CHECK_DECLS([sinhf], [REPLACE_SINHF=1], , [[#include <math.h>]])
     SINHF_LIBM="$SINH_LIBM"
   fi
   AC_SUBST([SINHF_LIBM])
index d4e2486a801e7019d75f290ca771cf2f8e818f6e..d674e1449954513d82100e36c132a521cfd4dbc9 100644 (file)
@@ -293,6 +293,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
              -e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
              -e 's|@''REPLACE_SINF''@|$(REPLACE_SINF)|g' \
+             -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \
              -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \
              -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \
              -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \