I get errors from MSVC in <netdb.h> i C++ mode. E.g. in compiling
test-netdb-c++.cc:

  netdb.h(189): error C2440: 'return': cannot convert
  from 'INT (__stdcall *)(PCSTR,PCSTR,const ADDRINFOA *,PADDRINFOA *)' to
  'gnulib_::_gl_getaddrinfo_wrapper::type'

Ditto error for '_gl_freeaddrinfo_wrapper'.

Some of the pre-processed output of the _GL_CXXALIAS_SYS() macro at
line 189 in netdb.h is:
  namespace gnulib_ {
    static const struct _gl_getaddrinfo_wrapper {
      typedef int (*type) (const char * nodename,
                           const char * servname,
                           const struct addrinfo * hints,
                           struct addrinfo ** res);
      __inline operator type () const
      {
        return ::getaddrinfo;  << !! error is here
      }
    }
    getaddrinfo = {};
  }

Instead this requires a 'reinterpret_cast<type>'.
Hence with this patch, it compiles and runs fine:

--- a/netdb.in.h 2016-01-30 20:42:17
+++ b/netdb.in.h 2016-12-15 12:53:28
@@ -170,7 +170,7 @@
                    struct addrinfo **restrict res)
                   _GL_ARG_NONNULL ((4)));
 # endif
-_GL_CXXALIAS_SYS (getaddrinfo, int,
+_GL_CXXALIAS_SYS_CAST (getaddrinfo, int,
                   (const char *restrict nodename,
                    const char *restrict servname,
                    const struct addrinfo *restrict hints,
@@ -184,7 +184,7 @@
 _GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai)
                                       _GL_ARG_NONNULL ((1)));
 # endif
-_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai));
+_GL_CXXALIAS_SYS_CAST (freeaddrinfo, void, (struct addrinfo *ai));
 _GL_CXXALIASWARN (freeaddrinfo);

 # if @REPLACE_GAI_STRERROR@

---------

This is because of Winsock's __stdcall I assume?

I've not checked all test-*.cc files for such errors.

-- 
--gv

Reply via email to