Compiling a gnulib testdir with 32-bit MSVC 14, I get these errors: C:\cygwin64\home\bruno\testdir-posix\gllib\acosf.c(24): error C2084: function 'float acosf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\asinf.c(24): error C2084: function 'float asinf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\atan2f.c(24): error C2084: function 'float atan2f(float,float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\atanf.c(24): error C2084: function 'float atanf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\cosf.c(24): error C2084: function 'float cosf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\coshf.c(24): error C2084: function 'float coshf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\expf.c(24): error C2084: function 'float expf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\fmodf.c(24): error C2084: function 'float fmodf(float,float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\fmodl.c(26): error C2084: function 'long double fmodl(long double,long double)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\hypotf.c(24): error C2084: function 'float hypotf(float,float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\hypotl.c(28): error C2084: function 'long double hypotl(long double,long double)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\log10f.c(25): error C2084: function 'float log10f(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\log10l.c(26): error C2084: function 'long double log10l(long double)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\logf.c(25): error C2084: function 'float logf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\sinf.c(24): error C2084: function 'float sinf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\sinhf.c(24): error C2084: function 'float sinhf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\sqrtf.c(24): error C2084: function 'float sqrtf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\tanf.c(24): error C2084: function 'float tanf(float)' already has a body C:\cygwin64\home\bruno\testdir-posix\gllib\tanhf.c(24): error C2084: function 'float tanhf(float)' already has a body
The reason is that these functions are defined as inline functions in <math.h>. Fixed through the attached changes (one per module). Pretty repetitive: it's always the same common idiom. Bruno
>From c3cb8a26341933b414e53e79457bb9906d07e9f3 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:08:14 +0100 Subject: [PATCH 01/20] 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 may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_ACOSF. * lib/math.in.h (acosf): Override if REPLACE_ACOSF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/acosf.m4 | 6 +++++- m4/math_h.m4 | 3 ++- modules/math | 3 ++- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ced537..9ab54ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@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 + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_ACOSF. + * lib/math.in.h (acosf): Override if REPLACE_ACOSF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + Avoid redefinition errors on MSVC. * m4/snprintf.m4 (gl_REPLACE_SNPRINTF): Set REPLACE_SNPRINTF to 1 if the function may be defined as an inline function. diff --git a/lib/math.in.h b/lib/math.in.h index e1dc970..f46d2df 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -212,11 +212,20 @@ _NaN () #if @GNULIB_ACOSF@ -# if !@HAVE_ACOSF@ -# undef acosf +# if @REPLACE_ACOSF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef acosf +# define acosf rpl_acosf +# endif +_GL_FUNCDECL_RPL (acosf, float, (float x)); +_GL_CXXALIAS_RPL (acosf, float, (float x)); +# else +# if !@HAVE_ACOSF@ +# undef acosf _GL_FUNCDECL_SYS (acosf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (acosf, float, (float x)); +# endif _GL_CXXALIASWARN (acosf); #elif defined GNULIB_POSIXCHECK # undef acosf diff --git a/m4/acosf.m4 b/m4/acosf.m4 index b5789d0..55bdd56 100644 --- a/m4/acosf.m4 +++ b/m4/acosf.m4 @@ -1,4 +1,4 @@ -# acosf.m4 serial 2 +# acosf.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_ACOSF], ACOSF_LIBM="$ACOS_LIBM" else HAVE_ACOSF=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_acosf, not acosf. + AC_CHECK_DECLS([acosf], [REPLACE_ACOSF=1], , [[#include <math.h>]]) ACOSF_LIBM="$ACOS_LIBM" fi AC_SUBST([ACOSF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 35d07ee..18d2ac8 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,4 +1,4 @@ -# math_h.m4 serial 114 +# math_h.m4 serial 115 dnl Copyright (C) 2007-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, @@ -256,6 +256,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) 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_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 6f924fd..0aa326b 100644 --- a/modules/math +++ b/modules/math @@ -225,7 +225,8 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \ -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \ | \ - sed -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \ + sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ + -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \ -e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \ -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -- 2.6.4
>From 6cd601d2b97592e7bd603bd8e0ec8aec7034faec Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> 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 <br...@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 <br...@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 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 !@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 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 <math.h>]]) 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
>From 4d3d2763fe89ba36c256f496f0e095c650756705 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:21:51 +0100 Subject: [PATCH 03/20] atanf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ATANF. * m4/atanf.m4 (gl_FUNC_ATANF): Set REPLACE_ATANF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_ATANF. * lib/math.in.h (atanf): Override if REPLACE_ATANF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/atanf.m4 | 6 +++++- m4/math_h.m4 | 1 + modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9789472..b03ae87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + atanf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ATANF. + * m4/atanf.m4 (gl_FUNC_ATANF): Set REPLACE_ATANF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_ATANF. + * lib/math.in.h (atanf): Override if REPLACE_ATANF is 1. + +2016-12-17 Bruno Haible <br...@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 diff --git a/lib/math.in.h b/lib/math.in.h index f76f6c6..04bbd4e 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -292,11 +292,20 @@ _GL_WARN_ON_USE (asinl, "asinl is unportable - " #if @GNULIB_ATANF@ -# if !@HAVE_ATANF@ -# undef atanf +# if @REPLACE_ATANF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef atanf +# define atanf rpl_atanf +# endif +_GL_FUNCDECL_RPL (atanf, float, (float x)); +_GL_CXXALIAS_RPL (atanf, float, (float x)); +# else +# if !@HAVE_ATANF@ +# undef atanf _GL_FUNCDECL_SYS (atanf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (atanf, float, (float x)); +# endif _GL_CXXALIASWARN (atanf); #elif defined GNULIB_POSIXCHECK # undef atanf diff --git a/m4/atanf.m4 b/m4/atanf.m4 index f7e4a07..178cefe 100644 --- a/m4/atanf.m4 +++ b/m4/atanf.m4 @@ -1,4 +1,4 @@ -# atanf.m4 serial 2 +# atanf.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_ATANF], ATANF_LIBM="$ATAN_LIBM" else HAVE_ATANF=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_atanf, not atanf. + AC_CHECK_DECLS([atanf], [REPLACE_ATANF=1], , [[#include <math.h>]]) ATANF_LIBM="$ATAN_LIBM" fi AC_SUBST([ATANF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 9abf7a9..7b2aa5a 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -258,6 +258,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) + REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) 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 07a9f47..bc8bc7b 100644 --- a/modules/math +++ b/modules/math @@ -227,6 +227,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( | \ sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \ + -e 's|@''REPLACE_ATANF''@|$(REPLACE_ATANF)|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
>From cf308efdb00585d5e7139c0e6eff3ad4854769a1 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:26:04 +0100 Subject: [PATCH 04/20] atan2f: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ATAN2F. * m4/atan2f.m4 (gl_FUNC_ATAN2F): Set REPLACE_ATAN2F to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_ATAN2F. * lib/math.in.h (atan2f): Override if REPLACE_ATAN2F is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/atan2f.m4 | 6 +++++- m4/math_h.m4 | 1 + modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b03ae87..afac64d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + atan2f: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ATAN2F. + * m4/atan2f.m4 (gl_FUNC_ATAN2F): Set REPLACE_ATAN2F to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_ATAN2F. + * lib/math.in.h (atan2f): Override if REPLACE_ATAN2F is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + atanf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ATANF. * m4/atanf.m4 (gl_FUNC_ATANF): Set REPLACE_ATANF to 1 if the function diff --git a/lib/math.in.h b/lib/math.in.h index 04bbd4e..9d28a43 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -332,11 +332,20 @@ _GL_WARN_ON_USE (atanl, "atanl is unportable - " #if @GNULIB_ATAN2F@ -# if !@HAVE_ATAN2F@ -# undef atan2f +# if @REPLACE_ATAN2F@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef atan2f +# define atan2f rpl_atan2f +# endif +_GL_FUNCDECL_RPL (atan2f, float, (float y, float x)); +_GL_CXXALIAS_RPL (atan2f, float, (float y, float x)); +# else +# if !@HAVE_ATAN2F@ +# undef atan2f _GL_FUNCDECL_SYS (atan2f, float, (float y, float x)); -# endif +# endif _GL_CXXALIAS_SYS (atan2f, float, (float y, float x)); +# endif _GL_CXXALIASWARN (atan2f); #elif defined GNULIB_POSIXCHECK # undef atan2f diff --git a/m4/atan2f.m4 b/m4/atan2f.m4 index c29f4cb..2788bf8 100644 --- a/m4/atan2f.m4 +++ b/m4/atan2f.m4 @@ -1,4 +1,4 @@ -# atan2f.m4 serial 2 +# atan2f.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_ATAN2F], ATAN2F_LIBM="$ATAN2_LIBM" else HAVE_ATAN2F=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_atan2f, not atan2f. + AC_CHECK_DECLS([atan2f], [REPLACE_ATAN2F=1], , [[#include <math.h>]]) ATAN2F_LIBM="$ATAN2_LIBM" fi AC_SUBST([ATAN2F_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 7b2aa5a..ec88b2a 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -259,6 +259,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) + REPLACE_ATAN2F=0; AC_SUBST([REPLACE_ATAN2F]) 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 bc8bc7b..a9de898 100644 --- a/modules/math +++ b/modules/math @@ -228,6 +228,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( sed -e 's|@''REPLACE_ACOSF''@|$(REPLACE_ACOSF)|g' \ -e 's|@''REPLACE_ASINF''@|$(REPLACE_ASINF)|g' \ -e 's|@''REPLACE_ATANF''@|$(REPLACE_ATANF)|g' \ + -e 's|@''REPLACE_ATAN2F''@|$(REPLACE_ATAN2F)|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
>From 9113a6db3f4efd150bfa77188e1277ff83aadc1b Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:31:58 +0100 Subject: [PATCH 05/20] cosf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_COSF. * m4/cosf.m4 (gl_FUNC_COSF): Set REPLACE_COSF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_COSF. * lib/math.in.h (cosf): Override if REPLACE_COSF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/cosf.m4 | 6 +++++- m4/math_h.m4 | 1 + modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index afac64d..b802d75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + cosf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_COSF. + * m4/cosf.m4 (gl_FUNC_COSF): Set REPLACE_COSF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_COSF. + * lib/math.in.h (cosf): Override if REPLACE_COSF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + atan2f: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_ATAN2F. * m4/atan2f.m4 (gl_FUNC_ATAN2F): Set REPLACE_ATAN2F to 1 if the function diff --git a/lib/math.in.h b/lib/math.in.h index 9d28a43..6065cfa 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -524,11 +524,20 @@ _GL_WARN_ON_USE (copysign, "copysignl is unportable - " #if @GNULIB_COSF@ -# if !@HAVE_COSF@ -# undef cosf +# if @REPLACE_COSF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef cosf +# define cosf rpl_cosf +# endif +_GL_FUNCDECL_RPL (cosf, float, (float x)); +_GL_CXXALIAS_RPL (cosf, float, (float x)); +# else +# if !@HAVE_COSF@ +# undef cosf _GL_FUNCDECL_SYS (cosf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (cosf, float, (float x)); +# endif _GL_CXXALIASWARN (cosf); #elif defined GNULIB_POSIXCHECK # undef cosf diff --git a/m4/cosf.m4 b/m4/cosf.m4 index 8315aa0..757d9b7 100644 --- a/m4/cosf.m4 +++ b/m4/cosf.m4 @@ -1,4 +1,4 @@ -# cosf.m4 serial 2 +# cosf.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_COSF], COSF_LIBM="$COS_LIBM" else HAVE_COSF=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_cosf, not cosf. + AC_CHECK_DECLS([cosf], [REPLACE_COSF=1], , [[#include <math.h>]]) COSF_LIBM="$COS_LIBM" fi AC_SUBST([COSF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index ec88b2a..89d3ab2 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -265,6 +265,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) + REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) diff --git a/modules/math b/modules/math index a9de898..abe1db4 100644 --- a/modules/math +++ b/modules/math @@ -234,6 +234,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \ -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ + -e 's|@''REPLACE_COSF''@|$(REPLACE_COSF)|g' \ -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \ -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \ -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \ -- 2.6.4
>From c3c53687f7772af44c67899be922b385a68533b0 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:36:54 +0100 Subject: [PATCH 06/20] coshf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_COSHF. * m4/coshf.m4 (gl_FUNC_COSHF): Set REPLACE_COSHF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_COSHF. * lib/math.in.h (coshf): Override if REPLACE_COSHF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/coshf.m4 | 6 +++++- m4/math_h.m4 | 1 + modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b802d75..bca6f78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + coshf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_COSHF. + * m4/coshf.m4 (gl_FUNC_COSHF): Set REPLACE_COSHF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_COSHF. + * lib/math.in.h (coshf): Override if REPLACE_COSHF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + cosf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_COSF. * m4/cosf.m4 (gl_FUNC_COSF): Set REPLACE_COSF to 1 if the function diff --git a/lib/math.in.h b/lib/math.in.h index 6065cfa..ccaf56c 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -564,11 +564,20 @@ _GL_WARN_ON_USE (cosl, "cosl is unportable - " #if @GNULIB_COSHF@ -# if !@HAVE_COSHF@ -# undef coshf +# if @REPLACE_COSHF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef coshf +# define coshf rpl_coshf +# endif +_GL_FUNCDECL_RPL (coshf, float, (float x)); +_GL_CXXALIAS_RPL (coshf, float, (float x)); +# else +# if !@HAVE_COSHF@ +# undef coshf _GL_FUNCDECL_SYS (coshf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (coshf, float, (float x)); +# endif _GL_CXXALIASWARN (coshf); #elif defined GNULIB_POSIXCHECK # undef coshf diff --git a/m4/coshf.m4 b/m4/coshf.m4 index 2cc0264..35977e2 100644 --- a/m4/coshf.m4 +++ b/m4/coshf.m4 @@ -1,4 +1,4 @@ -# coshf.m4 serial 2 +# coshf.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_COSHF], COSHF_LIBM="$COSH_LIBM" else HAVE_COSHF=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_coshf, not coshf. + AC_CHECK_DECLS([coshf], [REPLACE_COSHF=1], , [[#include <math.h>]]) COSHF_LIBM="$COSH_LIBM" fi AC_SUBST([COSHF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 89d3ab2..6993389 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -266,6 +266,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) + REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) diff --git a/modules/math b/modules/math index abe1db4..0fa946b 100644 --- a/modules/math +++ b/modules/math @@ -235,6 +235,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \ -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ -e 's|@''REPLACE_COSF''@|$(REPLACE_COSF)|g' \ + -e 's|@''REPLACE_COSHF''@|$(REPLACE_COSHF)|g' \ -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \ -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \ -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \ -- 2.6.4
>From 21ec014a2ffe8d53dd1d4744ff5775853340e3cb Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:41:12 +0100 Subject: [PATCH 07/20] expf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_EXPF. * m4/expf.m4 (gl_FUNC_EXPF): Set REPLACE_EXPF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_EXPF. * lib/math.in.h (expf): Override if REPLACE_EXPF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/expf.m4 | 6 +++++- m4/math_h.m4 | 1 + modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bca6f78..cb25d65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + expf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_EXPF. + * m4/expf.m4 (gl_FUNC_EXPF): Set REPLACE_EXPF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_EXPF. + * lib/math.in.h (expf): Override if REPLACE_EXPF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + coshf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_COSHF. * m4/coshf.m4 (gl_FUNC_COSHF): Set REPLACE_COSHF to 1 if the function diff --git a/lib/math.in.h b/lib/math.in.h index ccaf56c..cc76a64 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -589,11 +589,20 @@ _GL_WARN_ON_USE (coshf, "coshf is unportable - " #if @GNULIB_EXPF@ -# if !@HAVE_EXPF@ -# undef expf +# if @REPLACE_EXPF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef expf +# define expf rpl_expf +# endif +_GL_FUNCDECL_RPL (expf, float, (float x)); +_GL_CXXALIAS_RPL (expf, float, (float x)); +# else +# if !@HAVE_EXPF@ +# undef expf _GL_FUNCDECL_SYS (expf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (expf, float, (float x)); +# endif _GL_CXXALIASWARN (expf); #elif defined GNULIB_POSIXCHECK # undef expf diff --git a/m4/expf.m4 b/m4/expf.m4 index b2ff3f6..83d3de9 100644 --- a/m4/expf.m4 +++ b/m4/expf.m4 @@ -1,4 +1,4 @@ -# expf.m4 serial 2 +# expf.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_EXPF], EXPF_LIBM="$EXP_LIBM" else HAVE_EXPF=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_expf, not expf. + AC_CHECK_DECLS([expf], [REPLACE_EXPF=1], , [[#include <math.h>]]) EXPF_LIBM="$EXP_LIBM" fi AC_SUBST([EXPF_LIBM]) diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 6993389..ac7a72d 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -267,6 +267,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) + REPLACE_EXPF=0; AC_SUBST([REPLACE_EXPF]) REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) diff --git a/modules/math b/modules/math index 0fa946b..497c692 100644 --- a/modules/math +++ b/modules/math @@ -236,6 +236,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \ -e 's|@''REPLACE_COSF''@|$(REPLACE_COSF)|g' \ -e 's|@''REPLACE_COSHF''@|$(REPLACE_COSHF)|g' \ + -e 's|@''REPLACE_EXPF''@|$(REPLACE_EXPF)|g' \ -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \ -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \ -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \ -- 2.6.4
>From 1a1d5eee3506691a9855a8f9fecd5e619542d128 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:44:34 +0100 Subject: [PATCH 08/20] fmodf: Avoid redefinition error on MSVC. * m4/fmodf.m4 (gl_FUNC_FMODF): Set REPLACE_FMODF to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/fmodf.m4 | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cb25d65..093964a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + fmodf: Avoid redefinition error on MSVC. + * m4/fmodf.m4 (gl_FUNC_FMODF): Set REPLACE_FMODF to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + expf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_EXPF. * m4/expf.m4 (gl_FUNC_EXPF): Set REPLACE_EXPF to 1 if the function diff --git a/m4/fmodf.m4 b/m4/fmodf.m4 index b055e73..8f5989d 100644 --- a/m4/fmodf.m4 +++ b/m4/fmodf.m4 @@ -1,4 +1,4 @@ -# fmodf.m4 serial 5 +# fmodf.m4 serial 6 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, @@ -75,6 +75,10 @@ int main (int argc, char *argv[]) ]) else HAVE_FMODF=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_fmodf, not fmodf. + AC_CHECK_DECLS([fmodf], [REPLACE_FMODF=1], , [[#include <math.h>]]) fi if test $HAVE_FMODF = 0 || test $REPLACE_FMODF = 1; then dnl Find libraries needed to link lib/fmodf.c. -- 2.6.4
>From b31297ff0bf6df85fe861075831268957c0f061d Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:47:46 +0100 Subject: [PATCH 09/20] fmodl: Avoid redefinition error on MSVC. * m4/fmodl.m4 (gl_FUNC_FMODL): Set REPLACE_FMODL to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/fmodl.m4 | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 093964a..0fdce80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + fmodl: Avoid redefinition error on MSVC. + * m4/fmodl.m4 (gl_FUNC_FMODL): Set REPLACE_FMODL to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + fmodf: Avoid redefinition error on MSVC. * m4/fmodf.m4 (gl_FUNC_FMODF): Set REPLACE_FMODF to 1 if the function may be defined as an inline function. diff --git a/m4/fmodl.m4 b/m4/fmodl.m4 index c772ab6..05dc6ec 100644 --- a/m4/fmodl.m4 +++ b/m4/fmodl.m4 @@ -1,4 +1,4 @@ -# fmodl.m4 serial 5 +# fmodl.m4 serial 6 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, @@ -86,6 +86,10 @@ int main (int argc, char *argv[]) ]) else HAVE_FMODL=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_fmodl, not fmodl. + AC_CHECK_DECLS([fmodl], [REPLACE_FMODL=1], , [[#include <math.h>]]) fi if test $HAVE_FMODL = 0 || test $REPLACE_FMODL = 1; then dnl Find libraries needed to link lib/fmodl.c. -- 2.6.4
>From c7f934de8352f3051580a022fbb5654c7f8b38b9 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:49:31 +0100 Subject: [PATCH 10/20] hypotf: Avoid redefinition error on MSVC. * m4/hypotf.m4 (gl_FUNC_HYPOTF): Set REPLACE_HYPOTF to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/hypotf.m4 | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0fdce80..bc16945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + hypotf: Avoid redefinition error on MSVC. + * m4/hypotf.m4 (gl_FUNC_HYPOTF): Set REPLACE_HYPOTF to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + fmodl: Avoid redefinition error on MSVC. * m4/fmodl.m4 (gl_FUNC_FMODL): Set REPLACE_FMODL to 1 if the function may be defined as an inline function. diff --git a/m4/hypotf.m4 b/m4/hypotf.m4 index a7c7f40..ebee6d9 100644 --- a/m4/hypotf.m4 +++ b/m4/hypotf.m4 @@ -1,4 +1,4 @@ -# hypotf.m4 serial 4 +# hypotf.m4 serial 5 dnl Copyright (C) 2012-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, @@ -21,6 +21,7 @@ AC_DEFUN([gl_FUNC_HYPOTF], LIBS="$save_LIBS" if test $ac_cv_func_hypotf = yes; then HYPOTF_LIBM="$HYPOT_LIBM" + save_LIBS="$LIBS" LIBS="$LIBS $HYPOTF_LIBM" gl_FUNC_HYPOTF_WORKS @@ -29,6 +30,7 @@ AC_DEFUN([gl_FUNC_HYPOTF], *yes) ;; *) REPLACE_HYPOTF=1 ;; esac + m4_ifdef([gl_FUNC_HYPOTF_IEEE], [ if test $gl_hypotf_required = ieee && test $REPLACE_HYPOTF = 0; then AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -85,6 +87,10 @@ int main (int argc, char *argv[]) ]) else HAVE_HYPOTF=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_hypotf, not hypotf. + AC_CHECK_DECLS([hypotf], [REPLACE_HYPOTF=1], , [[#include <math.h>]]) fi if test $HAVE_HYPOTF = 0 || test $REPLACE_HYPOTF = 1; then dnl Find libraries needed to link lib/hypotf.c. -- 2.6.4
>From 048631b655b85230dcdf0c95390ce5ff51caf147 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 19:51:29 +0100 Subject: [PATCH 11/20] hypotl: Avoid redefinition error on MSVC. * m4/hypotl.m4 (gl_FUNC_HYPOTL): Set REPLACE_HYPOTL to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/hypotl.m4 | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bc16945..963f453 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + hypotl: Avoid redefinition error on MSVC. + * m4/hypotl.m4 (gl_FUNC_HYPOTL): Set REPLACE_HYPOTL to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + hypotf: Avoid redefinition error on MSVC. * m4/hypotf.m4 (gl_FUNC_HYPOTF): Set REPLACE_HYPOTF to 1 if the function may be defined as an inline function. diff --git a/m4/hypotl.m4 b/m4/hypotl.m4 index d972acf..e756329 100644 --- a/m4/hypotl.m4 +++ b/m4/hypotl.m4 @@ -1,4 +1,4 @@ -# hypotl.m4 serial 5 +# hypotl.m4 serial 6 dnl Copyright (C) 2012-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, @@ -87,6 +87,10 @@ int main (int argc, char *argv[]) ]) else HAVE_HYPOTL=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_hypotl, not hypotl. + AC_CHECK_DECLS([hypotl], [REPLACE_HYPOTL=1], , [[#include <math.h>]]) fi if test $HAVE_HYPOTL = 0 || test $REPLACE_HYPOTL = 1; then dnl Find libraries needed to link lib/hypotl.c. -- 2.6.4
>From fd9c0606644e59a6f27ddb5a79feabf82493b15b Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:30:33 +0100 Subject: [PATCH 12/20] log10f: Avoid redefinition error on MSVC. * m4/log10f.m4 (gl_FUNC_LOG10F): Set REPLACE_LOG10F to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/log10f.m4 | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 963f453..61b04bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + log10f: Avoid redefinition error on MSVC. + * m4/log10f.m4 (gl_FUNC_LOG10F): Set REPLACE_LOG10F to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + hypotl: Avoid redefinition error on MSVC. * m4/hypotl.m4 (gl_FUNC_HYPOTL): Set REPLACE_HYPOTL to 1 if the function may be defined as an inline function. diff --git a/m4/log10f.m4 b/m4/log10f.m4 index 5243cd0..ed09b17 100644 --- a/m4/log10f.m4 +++ b/m4/log10f.m4 @@ -1,4 +1,4 @@ -# log10f.m4 serial 6 +# log10f.m4 serial 7 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, @@ -84,6 +84,10 @@ int main (int argc, char *argv[]) ]) else HAVE_LOG10F=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_log10f, not log10f. + AC_CHECK_DECLS([log10f], [REPLACE_LOG10F=1], , [[#include <math.h>]]) fi if test $HAVE_LOG10F = 0 || test $REPLACE_LOG10F = 1; then dnl Find libraries needed to link lib/log10f.c. -- 2.6.4
>From ef458c87188265ccd056376432f4a84ad4e965ad Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:32:14 +0100 Subject: [PATCH 13/20] log10l: Avoid redefinition error on MSVC. * m4/log10l.m4 (gl_FUNC_LOG10L): Set REPLACE_LOG10L to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/log10l.m4 | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 61b04bf..7886bd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + log10l: Avoid redefinition error on MSVC. + * m4/log10l.m4 (gl_FUNC_LOG10L): Set REPLACE_LOG10L to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + log10f: Avoid redefinition error on MSVC. * m4/log10f.m4 (gl_FUNC_LOG10F): Set REPLACE_LOG10F to 1 if the function may be defined as an inline function. diff --git a/m4/log10l.m4 b/m4/log10l.m4 index 8ea35a7..a31f5cf 100644 --- a/m4/log10l.m4 +++ b/m4/log10l.m4 @@ -1,4 +1,4 @@ -# log10l.m4 serial 3 +# log10l.m4 serial 4 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, @@ -35,6 +35,10 @@ AC_DEFUN([gl_FUNC_LOG10L], esac else HAVE_LOG10L=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_log10l, not log10l. + AC_CHECK_DECLS([log10l], [REPLACE_LOG10L=1], , [[#include <math.h>]]) fi if test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; then if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then -- 2.6.4
>From 33b84df8e31cd2e2c9058c3ff935e3ddfc8e01d0 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:34:06 +0100 Subject: [PATCH 14/20] logf: Avoid redefinition error on MSVC. * m4/logf.m4 (gl_FUNC_LOGF): Set REPLACE_LOGF to 1 if the function may be defined as an inline function. --- ChangeLog | 6 ++++++ m4/logf.m4 | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7886bd9..6f95707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + logf: Avoid redefinition error on MSVC. + * m4/logf.m4 (gl_FUNC_LOGF): Set REPLACE_LOGF to 1 if the function + may be defined as an inline function. + +2016-12-17 Bruno Haible <br...@clisp.org> + log10l: Avoid redefinition error on MSVC. * m4/log10l.m4 (gl_FUNC_LOG10L): Set REPLACE_LOG10L to 1 if the function may be defined as an inline function. diff --git a/m4/logf.m4 b/m4/logf.m4 index 67935bb..abb4fb8 100644 --- a/m4/logf.m4 +++ b/m4/logf.m4 @@ -1,4 +1,4 @@ -# logf.m4 serial 6 +# logf.m4 serial 7 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, @@ -84,6 +84,10 @@ int main (int argc, char *argv[]) ]) else HAVE_LOGF=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_logf, not logf. + AC_CHECK_DECLS([logf], [REPLACE_LOGF=1], , [[#include <math.h>]]) fi if test $HAVE_LOGF = 0 || test $REPLACE_LOGF = 1; then dnl Find libraries needed to link lib/logf.c. -- 2.6.4
>From a8cff6cb02078518e50965da9e165d2d5ad495d1 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:38:33 +0100 Subject: [PATCH 15/20] sinf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_SINF. * m4/sinf.m4 (gl_FUNC_SINF): Set REPLACE_SINF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_SINF. * lib/math.in.h (sinf): Override if REPLACE_SINF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/math_h.m4 | 1 + m4/sinf.m4 | 6 +++++- modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f95707..fd9cba0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + sinf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_SINF. + * m4/sinf.m4 (gl_FUNC_SINF): Set REPLACE_SINF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_SINF. + * lib/math.in.h (sinf): Override if REPLACE_SINF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + logf: Avoid redefinition error on MSVC. * m4/logf.m4 (gl_FUNC_LOGF): Set REPLACE_LOGF to 1 if the function may be defined as an inline function. diff --git a/lib/math.in.h b/lib/math.in.h index cc76a64..34730f7 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -1890,11 +1890,20 @@ _GL_WARN_ON_USE (roundl, "roundl is unportable - " #if @GNULIB_SINF@ -# if !@HAVE_SINF@ -# undef sinf +# if @REPLACE_SINF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sinf +# define sinf rpl_sinf +# endif +_GL_FUNCDECL_RPL (sinf, float, (float x)); +_GL_CXXALIAS_RPL (sinf, float, (float x)); +# else +# if !@HAVE_SINF@ + # undef sinf _GL_FUNCDECL_SYS (sinf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (sinf, float, (float x)); +# endif _GL_CXXALIASWARN (sinf); #elif defined GNULIB_POSIXCHECK # undef sinf diff --git a/m4/math_h.m4 b/m4/math_h.m4 index ac7a72d..538a650 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -322,6 +322,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) 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_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) diff --git a/m4/sinf.m4 b/m4/sinf.m4 index b40f97d..5429e92 100644 --- a/m4/sinf.m4 +++ b/m4/sinf.m4 @@ -1,4 +1,4 @@ -# sinf.m4 serial 2 +# sinf.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_SINF], SINF_LIBM="$SIN_LIBM" else HAVE_SINF=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_sinf, not sinf. + AC_CHECK_DECLS([sinf], [REPLACE_SINF=1], , [[#include <math.h>]]) SINF_LIBM="$SIN_LIBM" fi AC_SUBST([SINF_LIBM]) diff --git a/modules/math b/modules/math index 497c692..d4e2486 100644 --- a/modules/math +++ b/modules/math @@ -292,6 +292,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \ -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_SQRTL''@|$(REPLACE_SQRTL)|g' \ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ -- 2.6.4
>From 0225ce36c62830488e71bf2786316279f0d46411 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:41:36 +0100 Subject: [PATCH 16/20] 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. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/math_h.m4 | 1 + m4/sinhf.m4 | 6 +++++- modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd9cba0..55393eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@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 <br...@clisp.org> + sinf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_SINF. * m4/sinf.m4 (gl_FUNC_SINF): Set REPLACE_SINF to 1 if the function diff --git a/lib/math.in.h b/lib/math.in.h index 34730f7..05aa8ea 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -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 diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 538a650..eac8692 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -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]) diff --git a/m4/sinhf.m4 b/m4/sinhf.m4 index f20d4f9..e78d5e5 100644 --- a/m4/sinhf.m4 +++ b/m4/sinhf.m4 @@ -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]) diff --git a/modules/math b/modules/math index d4e2486..d674e14 100644 --- a/modules/math +++ b/modules/math @@ -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' \ -- 2.6.4
>From c7a2c318d3e7af5331ff5571125702c0c57546f6 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:44:37 +0100 Subject: [PATCH 17/20] 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. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/math_h.m4 | 1 + m4/sqrtf.m4 | 6 +++++- modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55393eb..a6593b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + 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. + +2016-12-17 Bruno Haible <br...@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 diff --git a/lib/math.in.h b/lib/math.in.h index 05aa8ea..842a636 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 diff --git a/m4/math_h.m4 b/m4/math_h.m4 index eac8692..cb41593 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -324,6 +324,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], 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_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) diff --git a/m4/sqrtf.m4 b/m4/sqrtf.m4 index ae9570f..a6fee07 100644 --- a/m4/sqrtf.m4 +++ b/m4/sqrtf.m4 @@ -1,4 +1,4 @@ -# sqrtf.m4 serial 2 +# sqrtf.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_SQRTF], SQRTF_LIBM="$SQRT_LIBM" else HAVE_SQRTF=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_sqrtf, not sqrtf. + AC_CHECK_DECLS([sqrtf], [REPLACE_SQRTF=1], , [[#include <math.h>]]) SQRTF_LIBM="$SQRT_LIBM" fi AC_SUBST([SQRTF_LIBM]) diff --git a/modules/math b/modules/math index d674e14..a22d369 100644 --- a/modules/math +++ b/modules/math @@ -294,6 +294,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -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_SQRTF''@|$(REPLACE_SQRTF)|g' \ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ -- 2.6.4
>From 9ef2e6d2053ea4d0068ecc1761f2ec81d4971790 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:48:34 +0100 Subject: [PATCH 18/20] tanf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_TANF. * m4/tanf.m4 (gl_FUNC_TANF): Set REPLACE_TANF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_TANF. * lib/math.in.h (tanf): Override if REPLACE_TANF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/math_h.m4 | 1 + m4/tanf.m4 | 6 +++++- modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6593b1..f16b24e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + tanf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_TANF. + * m4/tanf.m4 (gl_FUNC_TANF): Set REPLACE_TANF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_TANF. + * lib/math.in.h (tanf): Override if REPLACE_TANF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + 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 diff --git a/lib/math.in.h b/lib/math.in.h index 842a636..44b4e88 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -2004,11 +2004,20 @@ _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - " #if @GNULIB_TANF@ -# if !@HAVE_TANF@ -# undef tanf +# if @REPLACE_TANF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tanf +# define tanf rpl_tanf +# endif +_GL_FUNCDECL_RPL (tanf, float, (float x)); +_GL_CXXALIAS_RPL (tanf, float, (float x)); +# else +# if !@HAVE_TANF@ +# undef tanf _GL_FUNCDECL_SYS (tanf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (tanf, float, (float x)); +# endif _GL_CXXALIASWARN (tanf); #elif defined GNULIB_POSIXCHECK # undef tanf diff --git a/m4/math_h.m4 b/m4/math_h.m4 index cb41593..01e23ad 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -326,6 +326,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) + REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) diff --git a/m4/tanf.m4 b/m4/tanf.m4 index fe48da5..92a5f23 100644 --- a/m4/tanf.m4 +++ b/m4/tanf.m4 @@ -1,4 +1,4 @@ -# tanf.m4 serial 2 +# tanf.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_TANF], TANF_LIBM="$TAN_LIBM" else HAVE_TANF=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_tanf, not tanf. + AC_CHECK_DECLS([tanf], [REPLACE_TANF=1], , [[#include <math.h>]]) TANF_LIBM="$TAN_LIBM" fi AC_SUBST([TANF_LIBM]) diff --git a/modules/math b/modules/math index a22d369..317e688 100644 --- a/modules/math +++ b/modules/math @@ -296,6 +296,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_SINHF''@|$(REPLACE_SINHF)|g' \ -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ + -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ -- 2.6.4
>From 51150279ad36c1b1bf180ff9e81542ebf192500e Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Sat, 17 Dec 2016 20:51:33 +0100 Subject: [PATCH 19/20] tanhf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_TANHF. * m4/tanhf.m4 (gl_FUNC_TANHF): Set REPLACE_TANHF to 1 if the function may be defined as an inline function. * modules/math (Makefile.am): Substitute REPLACE_TANHF. * lib/math.in.h (tanhf): Override if REPLACE_TANHF is 1. --- ChangeLog | 9 +++++++++ lib/math.in.h | 15 ++++++++++++--- m4/math_h.m4 | 1 + m4/tanhf.m4 | 6 +++++- modules/math | 1 + 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f16b24e..7870489 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2016-12-17 Bruno Haible <br...@clisp.org> + tanhf: Avoid redefinition error on MSVC. + * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_TANHF. + * m4/tanhf.m4 (gl_FUNC_TANHF): Set REPLACE_TANHF to 1 if the function + may be defined as an inline function. + * modules/math (Makefile.am): Substitute REPLACE_TANHF. + * lib/math.in.h (tanhf): Override if REPLACE_TANHF is 1. + +2016-12-17 Bruno Haible <br...@clisp.org> + tanf: Avoid redefinition error on MSVC. * m4/math_h.m4 (gl_MATH_H_DEFAULTS): Define REPLACE_TANF. * m4/tanf.m4 (gl_FUNC_TANF): Set REPLACE_TANF to 1 if the function diff --git a/lib/math.in.h b/lib/math.in.h index 44b4e88..494432f 100644 --- a/lib/math.in.h +++ b/lib/math.in.h @@ -2044,11 +2044,20 @@ _GL_WARN_ON_USE (tanl, "tanl is unportable - " #if @GNULIB_TANHF@ -# if !@HAVE_TANHF@ -# undef tanhf +# if @REPLACE_TANHF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tanhf +# define tanhf rpl_tanhf +# endif +_GL_FUNCDECL_RPL (tanhf, float, (float x)); +_GL_CXXALIAS_RPL (tanhf, float, (float x)); +# else +# if !@HAVE_TANHF@ +# undef tanhf _GL_FUNCDECL_SYS (tanhf, float, (float x)); -# endif +# endif _GL_CXXALIAS_SYS (tanhf, float, (float x)); +# endif _GL_CXXALIASWARN (tanhf); #elif defined GNULIB_POSIXCHECK # undef tanhf diff --git a/m4/math_h.m4 b/m4/math_h.m4 index 01e23ad..d427b9b 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -327,6 +327,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) + REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) diff --git a/m4/tanhf.m4 b/m4/tanhf.m4 index 010e991..b591c41 100644 --- a/m4/tanhf.m4 +++ b/m4/tanhf.m4 @@ -1,4 +1,4 @@ -# tanhf.m4 serial 2 +# tanhf.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_TANHF], TANHF_LIBM="$TANH_LIBM" else HAVE_TANHF=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_tanhf, not tanhf. + AC_CHECK_DECLS([tanhf], [REPLACE_TANHF=1], , [[#include <math.h>]]) TANHF_LIBM="$TANH_LIBM" fi AC_SUBST([TANHF_LIBM]) diff --git a/modules/math b/modules/math index 317e688..2f553ba 100644 --- a/modules/math +++ b/modules/math @@ -297,6 +297,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $( -e 's|@''REPLACE_SQRTF''@|$(REPLACE_SQRTF)|g' \ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \ -e 's|@''REPLACE_TANF''@|$(REPLACE_TANF)|g' \ + -e 's|@''REPLACE_TANHF''@|$(REPLACE_TANHF)|g' \ -e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \ -e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \ -- 2.6.4