bug-gnulib
[Top][All Lists]
Advanced

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

Re: C++ and read redefinition


From: Daniel R. Hurtmans
Subject: Re: C++ and read redefinition
Date: Mon, 7 Dec 2020 10:54:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3


Hello Bruno,

Thanks for your reactivity!

I made the changes, and it almost works (at least errors which where generated before are gone).
But now I get these:

../lib/stdlib.h: In member function ‘gnulib::_gl_putenv_wrapper::operator gnulib::_gl_putenv_wrapper::type() const’: ../lib/stdlib.h:1247:1: error: invalid conversion from ‘int (*)(const char*)’ to ‘gnulib::_gl_putenv_wrapper::type’ {aka ‘int (*)(char*)’} [-fpermissive]
   1247 | _GL_CXXALIAS_MDA (putenv, int, (char *string));
        | ^~~~~~~~~~~~~~~~
        | |
        | int (*)(const char*)
../lib/unistd.h: In member function ‘gnulib::_gl_chdir_wrapper::operator gnulib::_gl_chdir_wrapper::type() const’: ../lib/unistd.h:847:1: error: ‘::_chdir’ has not been declared; did you mean ‘_wchdir’?
    847 | _GL_CXXALIAS_MDA (chdir, int, (const char *file));
        | ^~~~~~~~~~~~~~~~
../lib/unistd.h: In member function ‘gnulib::_gl_getcwd_wrapper::operator gnulib::_gl_getcwd_wrapper::type() const’: ../lib/unistd.h:1447:1: error: invalid conversion from ‘char* (*)(char*, int)’ to ‘gnulib::_gl_getcwd_wrapper::type’ {aka ‘char* (*)(char*, long long unsigned int)’} [-fpermissive]
   1447 | _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
        | ^~~~~~~~~~~~~~~~
        | |
        | char* (*)(char*, int)
../lib/unistd.h: In member function ‘gnulib::_gl_rmdir_wrapper::operator gnulib::_gl_rmdir_wrapper::type() const’: ../lib/unistd.h:2311:1: error: ‘::_rmdir’ has not been declared; did you mean ‘_wrmdir’?
   2311 | _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
        | ^~~~~~~~~~~~~~~~

I guess they mean that some other redeclarations need to be "protected" by the GNULIB_NAMESPACE.

Daniel


On 06/12/2020 16:48, Bruno Haible wrote:
Daniel R. Hurtmans wrote:
undefined reference to `std::basic_ifstream<char, std::char_traits<char>
  >::_close()'

Oh, so the OpenMP #pragma is not the only problem. It potentially affects
all of the symbols that are #defined.

I'm committing the attached two patches. The idea is to not use #defines
for redirecting functions in C++ mode, when GNULIB_NAMESPACE is defined.

With these patches, you should be able to revert the workaround that I
suggested earlier. But you need to define GNULIB_NAMESPACE.


2020-12-06  Bruno Haible  <bruno@clisp.org>

        Do the Windows oldnames workaround through the C++ GNULIB_NAMESPACE.
        Reported by Daniel R. Hurtmans <Daniel.Hurtmans@ulb.ac.be> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00029.html>.
        * lib/c++defs.h (_GL_CXXALIAS_MDA_CAST): New macro.
        * lib/fcntl.in.h (creat, open):  In C++ mode, when GNULIB_NAMESPACE is
        defined: 1. Define a symbol in this namespace. 2. Don't redirect using
        a preprocessor #define.
        * lib/math.in.h (j0, j1, jn, y0, y1, yn): Likewise.
        * lib/search.in.h (lfind, lsearch): Likewise.
        * lib/stdio.in.h (fcloseall, fdopen, fileno, getw, putw, tempnam):
        Likewise.
        * lib/stdlib.in.h (ecvt, fcvt, gcvt, mktemp, putenv): Likewise.
        * lib/string.in.h (memccpy, strdup): Likewise.
        * lib/sys_stat.in.h (chmod, umask): Likewise.
        * lib/time.in.h (tzset): Likewise.
        * lib/unistd.in.h (access, chdir, close, dup, dup2, execl, execle,
        execlp, execv, execve, execvp, execvpe, getcwd, getpid, isatty, lseek,
        read, rmdir, swab, unlink, write): Likewise.
        * lib/utime.in.h (utime): Likewise.
        * lib/wchar.in.h (wcsdup): Likewise.
        * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_FCLOSEALL.
        (gl_STDIO_H): Set HAVE_DECL_FCLOSEALL.
        * modules/stdio (Makefile.am): Substitute HAVE_DECL_FCLOSEALL.
        * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize HAVE_DECL_ECVT,
        HAVE_DECL_FCVT, HAVE_DECL_GCVT.
        (gl_STDLIB_H): Set HAVE_DECL_ECVT, HAVE_DECL_FCVT, HAVE_DECL_GCVT.
        * modules/stdlib (Makefile.am): Substitute HAVE_DECL_ECVT,
        HAVE_DECL_FCVT, HAVE_DECL_GCVT.
        * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize HAVE_DECL_EXECVPE.
        (gl_UNISTD_H): Set HAVE_DECL_EXECVPE.
        * modules/unistd (Makefile.am): Substitute HAVE_DECL_EXECVPE.
        * m4/wchar_h.m4 (gl_WCHAR_H_DEFAULTS): Initialize HAVE_DECL_WCSDUP.
        (gl_WCHAR_H): Set HAVE_DECL_WCSDUP.
        * modules/wchar (Makefile.am): Substitute HAVE_DECL_WCSDUP.

2020-12-06  Bruno Haible  <bruno@clisp.org>

        doc: Mention some missing function declarations.
        * doc/glibc-functions/execvpe.texi: Mention the missing declaration on
        AIX.
        * doc/glibc-functions/fcloseall.texi: Mention the missing declaration on
        FreeBSD.
        * doc/pastposix-functions/ecvt.texi: Mention the missing declaration on
        Cygwin.
        * doc/pastposix-functions/fcvt.texi: Likewise.
        * doc/pastposix-functions/gcvt.texi: Likewise.




reply via email to

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