>From 6cd601d2b97592e7bd603bd8e0ec8aec7034faec Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 17 Dec 2016 19:15:56 +0100 Subject: [PATCH 02/20] 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. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/asinf.m4 | 6 +++++- m4/math_h.m4 | 1 + modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ab54ca..9789472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible + 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 + 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 f46d2df..f76f6c6 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 address@hidden@ -# 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 address@hidden@ +# 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 af0b8ff..b531219 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 ]]) ASINF_LIBM="$ASIN_LIBM" fi AC_SUBST([ASINF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 18d2ac8..9abf7a9 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 0aa326b..07a9f47 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' \ -- 2.6.4