summaryrefslogtreecommitdiff
path: root/lib/math.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-12-17 20:44:37 +0100
committerBruno Haible <bruno@clisp.org>2016-12-17 23:09:17 +0100
commitc7a2c318d3e7af5331ff5571125702c0c57546f6 (patch)
tree0071bf17bb28c5334e06aae4055bea95a7574d03 /lib/math.in.h
parent0225ce36c62830488e71bf2786316279f0d46411 (diff)
downloadgnulib-c7a2c318d3e7af5331ff5571125702c0c57546f6.tar.gz
sqrtf: Avoid redefinition error on MSVC.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_SQRTF. * m4/sqrtf.m4 (gl_FUNC_SQRTF): Set REPLACE_SQRTF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_SQRTF. * lib/math.in.h (sqrtf): Override if REPLACE_SQRTF is 1.
Diffstat (limited to 'lib/math.in.h')
-rw-r--r--lib/math.in.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/math.in.h b/lib/math.in.h
index 05aa8eafdd..842a6369b2 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1955,11 +1955,20 @@ _GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
#if @GNULIB_SQRTF@
-# if !@HAVE_SQRTF@
-# undef sqrtf
+# if @REPLACE_SQRTF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef sqrtf
+# define sqrtf rpl_sqrtf
+# endif
+_GL_FUNCDECL_RPL (sqrtf, float, (float x));
+_GL_CXXALIAS_RPL (sqrtf, float, (float x));
+# else
+# if !@HAVE_SQRTF@
+# undef sqrtf
_GL_FUNCDECL_SYS (sqrtf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (sqrtf, float, (float x));
+# endif
_GL_CXXALIASWARN (sqrtf);
#elif defined GNULIB_POSIXCHECK
# undef sqrtf