summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-12-17 19:15:56 +0100
committerBruno Haible <bruno@clisp.org>2016-12-17 23:09:01 +0100
commit6cd601d2b97592e7bd603bd8e0ec8aec7034faec (patch)
tree7f64388ea810889bd631ac0d20d0b3baca183187
parentc3cb8a26341933b414e53e79457bb9906d07e9f3 (diff)
downloadgnulib-6cd601d2b97592e7bd603bd8e0ec8aec7034faec.tar.gz
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.
-rw-r--r--ChangeLog9
-rw-r--r--lib/math.in.h15
-rw-r--r--m4/asinf.m46
-rw-r--r--m4/math_h.m41
-rw-r--r--modules/math1
5 files changed, 28 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ab54ca8e6..9789472144 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
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.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ACOSF.
* m4/acosf.m4 (gl_FUNC_ACOSF): Set REPLACE_ACOSF to 1 if the function
diff --git a/lib/math.in.h b/lib/math.in.h
index f46d2df477..f76f6c6aab 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -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
diff --git a/m4/asinf.m4 b/m4/asinf.m4
index af0b8ff2e6..b531219909 100644
--- a/m4/asinf.m4
+++ b/m4/asinf.m4
@@ -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])
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index 18d2ac8b39..9abf7a9c84 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -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])
diff --git a/modules/math b/modules/math
index 0aa326b25b..07a9f47dcd 100644
--- a/modules/math
+++ b/modules/math
@@ -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' \