bug-gnulib
[Top][All Lists]
Advanced

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

Re: MinGW compilation warning in fseeko


From: Eli Zaretskii
Subject: Re: MinGW compilation warning in fseeko
Date: Sat, 12 May 2018 16:09:29 +0300

> From: Bruno Haible <address@hidden>
> Cc: Tim Rühsen <address@hidden>
> Date: Sat, 12 May 2018 14:31:59 +0200
> 
> > This is because configure-time test for _fseeki64 succeeds, but the
> > prototype of _fseeki64 is not visible unless the condition
> > 
> >   _WIN32_WINNT >= 0x0600
> > 
> > holds
> 
> According to 
> https://sourceforge.net/p/mingw/mingw-org-wsl/ci/5.1-trunk/tree/mingwrt/include/stdio.h#l743
> the condition should be
>    _WIN32_WINNT >= _WIN32_WINNT_VISTA || __MSVCRT_VERSION__ >= __MSVCR80_DLL
> I guess...

Yes.  They both express the same intent, in slightly different ways
(which have subtly different effects, but I don't think we should
muddy the waters by bringing them up here).  The intent is to target
MSVCRT versions that came with Vista and later versions.

> Anyway, the issue is that the "old" mingw defines fseeko64 instead of
> _fseeki64, and the gnulib code attempts to distinguish the two cases:
> 
> # if HAVE__FSEEKI64 /* msvc, mingw64 */
> #  define fseeko _fseeki64
> # else /* mingw */
> #  define fseeko fseeko64
> # endif
> 
> But the distinction between mingw-w64 and mingw.org is broken.
> 
> Do you know how to distinguish the two, just by preprocessor defines,
> without any autoconf test?

AFAIK, it's tricky, because MinGW64 also defines __MINGW32__, and
doesn't have any macro specific to it that is defined by the compiler
itself.  In Emacs we use this ugly hack to resolve the problem:

  /* MinGW-w64 gcc does not automatically define a macro for
     differentiating it fom MinGW gcc. We need to test the presence of
     __MINGW64_VERSION_MAJOR in _mingw.h: */
  #ifdef __MINGW32__
  # include <_mingw.h>
  # ifdef __MINGW64_VERSION_MAJOR
  #  define MINGW_W64
  # endif
  #endif

and then test MINGW_W64 elsewhere.



reply via email to

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