bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix some link failures on MSVC


From: Bruno Haible
Subject: fix some link failures on MSVC
Date: Sat, 25 Feb 2012 02:11:40 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

On MSVC 9, I reported these link errors:


source='test-acosl.c' object='test-acosl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-acosl.obj `cygpath -w 'test-acosl.c'`
test-acosl.c
test-acosl.c(24) : error C2065: 'acosl': nichtdeklarierter Bezeichner
test-acosl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-acosl.obj] Error 2

source='test-asinl.c' object='test-asinl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-asinl.obj `cygpath -w 'test-asinl.c'`
test-asinl.c
test-asinl.c(24) : error C2065: 'asinl': nichtdeklarierter Bezeichner
test-asinl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-asinl.obj] Error 2

source='test-atanl.c' object='test-atanl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-atanl.obj `cygpath -w 'test-atanl.c'`
test-atanl.c
test-atanl.c(24) : error C2065: 'atanl': nichtdeklarierter Bezeichner
test-atanl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-atanl.obj] Error 2

source='test-cosl.c' object='test-cosl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-cosl.obj `cygpath -w 'test-cosl.c'`
test-cosl.c
test-cosl.c(24) : error C2065: 'cosl': nichtdeklarierter Bezeichner
test-cosl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-cosl.obj] Error 2

source='test-expl.c' object='test-expl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-expl.obj `cygpath -w 'test-expl.c'`
test-expl.c
test-expl.c(24) : error C2065: 'expl': nichtdeklarierter Bezeichner
test-expl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-expl.obj] Error 2

source='test-floorl.c' object='test-floorl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-floorl.obj `cygpath -w 'test-floorl.c'`
test-floorl.c
test-floorl.c(24) : error C2065: 'floorl': nichtdeklarierter Bezeichner
test-floorl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-floorl.obj] Error 2

source='test-logl.c' object='test-logl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-logl.obj `cygpath -w 'test-logl.c'`
test-logl.c
test-logl.c(24) : error C2065: 'logl': nichtdeklarierter Bezeichner
test-logl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-logl.obj] Error 2

source='test-sinl.c' object='test-sinl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-sinl.obj `cygpath -w 'test-sinl.c'`
test-sinl.c
test-sinl.c(24) : error C2065: 'sinl': nichtdeklarierter Bezeichner
test-sinl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-sinl.obj] Error 2

source='test-sqrtl.c' object='test-sqrtl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-sqrtl.obj `cygpath -w 'test-sqrtl.c'`
test-sqrtl.c
test-sqrtl.c(24) : error C2065: 'sqrtl': nichtdeklarierter Bezeichner
test-sqrtl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-sqrtl.obj] Error 2

source='test-tanl.c' object='test-tanl.obj' libtool=no \
        DEPDIR=.deps depmode=none /bin/sh ../build-aux/depcomp \
        /home/bruno/msvc/compile cl -nologo -DHAVE_CONFIG_H -I. -I..  
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../gllib 
-I./../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/msvc/include  -MD 
-c -o test-tanl.obj `cygpath -w 'test-tanl.c'`
test-tanl.c
test-tanl.c(24) : error C2065: 'tanl': nichtdeklarierter Bezeichner
test-tanl.c(24) : error C2099: Initialisierung ist keine Konstante
make[4]: *** [test-tanl.obj] Error 2


The reason is that the functions sqrtl etc. are defined as macros and
only as macros. But POSIX requires them to be present as functions even
after the symbols are #undef'ed. (See
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html
section 2.1.1 paragraphs 2 and 4.)


This fixes it for sqrtl. And similarly for the others.


2012-02-24  Bruno Haible  <address@hidden>

        sqrtl: Provide function definition on MSVC.
        * m4/sqrtl.m4 (gl_FUNC_SQRTL): Test also whether sqrtl can be used as
        a function pointer.
        * lib/math.in.h (sqrtl): Undefine if it does not exist as a function.

--- lib/math.in.h.orig  Fri Feb 24 23:58:41 2012
+++ lib/math.in.h       Fri Feb 24 23:45:16 2012
@@ -1000,6 +1000,7 @@
 
 #if @GNULIB_SQRTL@
 # if address@hidden@ || address@hidden@
+#  undef sqrtl
 _GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
 # endif
 _GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
--- m4/sqrtl.m4.orig    Fri Feb 24 23:58:41 2012
+++ m4/sqrtl.m4 Fri Feb 24 21:20:45 2012
@@ -1,4 +1,4 @@
-# sqrtl.m4 serial 6
+# sqrtl.m4 serial 7
 dnl Copyright (C) 2010-2012 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,8 +22,10 @@
              # define __NO_MATH_INLINES 1 /* for glibc */
              #endif
              #include <math.h>
+             long double (*funcptr) (long double) = sqrtl;
              long double x;]],
-           [[return sqrtl (x) > 0.4;]])],
+           [[return funcptr (x) > 0.4
+                    || sqrtl (x) > 0.4;]])],
         [gl_cv_func_sqrtl_no_libm=yes],
         [gl_cv_func_sqrtl_no_libm=no])
     ])
@@ -39,8 +41,10 @@
                # define __NO_MATH_INLINES 1 /* for glibc */
                #endif
                #include <math.h>
+               long double (*funcptr) (long double) = sqrtl;
                long double x;]],
-             [[return sqrtl (x) > 0.4;]])],
+             [[return funcptr (x) > 0.4
+                      || sqrtl (x) > 0.4;]])],
           [gl_cv_func_sqrtl_in_libm=yes],
           [gl_cv_func_sqrtl_in_libm=no])
         LIBS="$save_LIBS"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]