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

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

index 9ab54ca8e6dd9a10155f0d2f11425074df80610b..9789472144e650e242078093c83a8a72d6d4be46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-12-17  Bruno Haible  <bruno@clisp.org>
+
+       asinf: Avoid redefinition error on MSVC.
+       * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ASINF.
+       * m4/asinf.m4 (gl_FUNC_ASINF): Set REPLACE_ASINF to 1 if the function
+       may be defined as an inline function.
+       * modules/math (Makefile.am): Substitute REPLACE_ASINF.
+       * lib/math.in.h (asinf): Override if REPLACE_ASINF is 1.
+
 2016-12-17  Bruno Haible  <bruno@clisp.org>
 
        acosf: Avoid redefinition error on MSVC.
index f46d2df4771821b4704ccfe62c7ffa08f769cba9..f76f6c6aab8f576f60ab3e51792350722b7b98d1 100644 (file)
@@ -252,11 +252,20 @@ _GL_WARN_ON_USE (acosl, "acosl is unportable - "
 
 
 #if @GNULIB_ASINF@
-# if !@HAVE_ASINF@
-#  undef asinf
+# if @REPLACE_ASINF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef asinf
+#   define asinf rpl_asinf
+#  endif
+_GL_FUNCDECL_RPL (asinf, float, (float x));
+_GL_CXXALIAS_RPL (asinf, float, (float x));
+# else
+#  if !@HAVE_ASINF@
+#   undef asinf
 _GL_FUNCDECL_SYS (asinf, float, (float x));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (asinf, float, (float x));
+# endif
 _GL_CXXALIASWARN (asinf);
 #elif defined GNULIB_POSIXCHECK
 # undef asinf
index af0b8ff2e6cd295a1968c47c640fcb9091873e3c..b5312199095220e260bc380497348665baeee4a1 100644 (file)
@@ -1,4 +1,4 @@
-# asinf.m4 serial 2
+# asinf.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_ASINF],
     ASINF_LIBM="$ASIN_LIBM"
   else
     HAVE_ASINF=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_asinf, not asinf.
+    AC_CHECK_DECLS([asinf], [REPLACE_ASINF=1], , [[#include <math.h>]])
     ASINF_LIBM="$ASIN_LIBM"
   fi
   AC_SUBST([ASINF_LIBM])
index 18d2ac8b39bf84d1f2dec608a4bda1f66308d8ca..9abf7a9c84cf82202da67a4a40ebf795b589bae0 100644 (file)
@@ -257,6 +257,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
   HAVE_DECL_TRUNCF=1;          AC_SUBST([HAVE_DECL_TRUNCF])
   HAVE_DECL_TRUNCL=1;          AC_SUBST([HAVE_DECL_TRUNCL])
   REPLACE_ACOSF=0;             AC_SUBST([REPLACE_ACOSF])
+  REPLACE_ASINF=0;             AC_SUBST([REPLACE_ASINF])
   REPLACE_CBRTF=0;             AC_SUBST([REPLACE_CBRTF])
   REPLACE_CBRTL=0;             AC_SUBST([REPLACE_CBRTL])
   REPLACE_CEIL=0;              AC_SUBST([REPLACE_CEIL])
index 0aa326b25b05e4210352d85a3834e9bce0f08b37..07a9f47dcd173476e54f3755d9242d6a6293af77 100644 (file)
@@ -226,6 +226,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
          | \
          sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \
+             -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \
              -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \
              -e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \
              -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \