bug-gnulib
[Top][All Lists]
Advanced

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

How to avoid fdopen redefinition?


From: Gavin Smith
Subject: How to avoid fdopen redefinition?
Date: Mon, 1 Mar 2021 15:29:26 +0000

When using a stdin.h from gnulib with Perl's extension headers (e.g.
XSUB.h), under MinGW there can be compiler warnings due to
redefinition of an fdopen symbol. This was reported here (point 1):

https://lists.gnu.org/archive/html/bug-texinfo/2021-02/msg00152.html

We don't use fdopen in the program so it would be better if we didn't
have to interact with this part of Gnulib. Is there any way of turning
this off?

The relevant part of stdin.in.h is the following:

#elif @GNULIB_MDA_FDOPEN@
/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not
   required.  In C++ with GNULIB_NAMESPACE, avoid differences between
   platforms by defining GNULIB_NAMESPACE::fdopen always.  */
# if defined _WIN32 && !defined __CYGWIN__
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   undef fdopen
#   define fdopen _fdopen
#  endif
_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode));
# else
_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
# endif
_GL_CXXALIASWARN (fdopen);
#endif

Is there any way of turning this off? We didn't use the stdio module
explicitly but it was a dependency of other Gnulib modules.

I saw this message from when some of the current code was introduced:

https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00220.html

It says in that message,

    Conditionalize each of the Windows oldnames workarounds through a
GNULIB_MDA_<func> symbol.

What would be the recommended way of doing this? Is it
AC_SUBST([GNULIB_MDA_FDOPEN]) or something else?

I don't know what MDA means and don't want to be hooking into Gnulib
internals with a process of sheer trial and error.

TIA



reply via email to

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