bug-gnulib
[Top][All Lists]
Advanced

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

Support several gnulib-tool invocations better


From: Bruno Haible
Subject: Support several gnulib-tool invocations better
Date: Tue, 24 Dec 2024 14:42:54 +0100

Gnulib supports multiple gnulib-tool invocations in the scope of the same
configure.ac since 2021 (cf. 2021-04-11, 2021-04-17, 2021-06-13). Namely,
the module indicator variable (@GNULIB_<module>@) expand to something that
depends on the gnulib-tool invocation.

This is still not working right with some header files, however. Namely,
the _GL_ALREADY_INCLUDING_*_H macros are a problem. In a build of GNU gettext
on mingw 13, I am seeing a compilation error:

gcc -DHAVE_CONFIG_H -I. -I../../../../gettext-tools/tests/gnulib-lib -I../..  
-I../../gnulib-lib -I../../../../gettext-tools/gnulib-lib 
-I/usr/local/mingw64/include -Wall  -Wno-cast-qual -Wno-conversion 
-Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function 
-Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough 
-Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unused-const-variable 
-Wno-unsuffixed-float-constants -g -O2 -MT libtestsgnu_a-pthread_sigmask.o -MD 
-MP -MF .deps/libtestsgnu_a-pthread_sigmask.Tpo -c -o 
libtestsgnu_a-pthread_sigmask.o `test -f 'pthread_sigmask.c' || echo 
'../../../../gettext-tools/tests/gnulib-lib/'`pthread_sigmask.c
../../../../gettext-tools/tests/gnulib-lib/pthread_sigmask.c: In function 
'rpl_pthread_sigmask':
../../../../gettext-tools/tests/gnulib-lib/pthread_sigmask.c:89:13: error: 
implicit declaration of function 'sigprocmask' [-Wimplicit-function-declaration]
   89 |   int ret = sigprocmask (how, new_mask, old_mask);
      |             ^~~~~~~~~~~
make[5]: *** [Makefile:3963: libtestsgnu_a-pthread_sigmask.o] Error 1

The module 'pthread_sigmask' depends on the module 'sigprocmask', so why
is sigprocmask not declared? It ought to be declared in gnulib's signal.h
override. The reason is that there are two signal.h overrides:
  1. tests/gnulib-lib/signal.h
  2. gnulib-lib/signal.h
In the gnulib-tool invocation #1, @GNULIB_SIGPROCMASK@ expands to 0.
In the gnulib-tool invocation #2, @GNULIB_SIGPROCMASK@ expands to 1.
When pthread_sigmask.c does #include <signal.h>, the include_next chain
consists of
  1. tests/gnulib-lib/signal.h
  2. gnulib-lib/signal.h
  3. the system's <signal.h>,
and since #1 defines _GL_ALREADY_INCLUDING_SIGNAL_H, #2 becomes
essentially a no-op. Thus the declaration of sigprocmask in #2 is hidden.

Here's a patch series that fixes that.


2024-12-24  Bruno Haible  <bruno@clisp.org>

        wchar: Support several gnulib-tool invocations better.
        * lib/wchar.in.h (_GL_ALREADY_INCLUDING_WCHAR_H): Rename to a macro that
        depends on GUARD_PREFIX.
        (mbszero): Avoid duplicate definition.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        threads-h: Support several gnulib-tool invocations better.
        * lib/threads.in.h (_GL_ALREADY_INCLUDING_THREADS_H): Rename to a macro
        that depends on GUARD_PREFIX.
        (struct thrd_with_exitcode): Avoid duplicate definition.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        sys_socket: Support several gnulib-tool invocations better.
        * lib/sys_socket.in.h (_GL_ALREADY_INCLUDING_SYS_SOCKET_H): Rename to a
        macro that depends on GUARD_PREFIX.
        (struct msghdr): Avoid duplicate definition.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        string: Support several gnulib-tool invocations better.
        * lib/string.in.h (_GL_ALREADY_INCLUDING_STRING_H): Rename to a macro
        that depends on GUARD_PREFIX.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        stdio: Support several gnulib-tool invocations better.
        * lib/stdio.in.h: Test _GL_SKIP_GNULIB_STDIO_H.
        (_GL_ALREADY_INCLUDING_STDIO_H): Rename to a macro that depends on
        GUARD_PREFIX.
        * lib/fopen.c: Set _GL_SKIP_GNULIB_STDIO_H instead of
        _GL_ALREADY_INCLUDING_STDIO_H.
        * lib/freopen.c: Likewise.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        spawn: Support several gnulib-tool invocations better.
        * lib/spawn.in.h (_GL_ALREADY_INCLUDING_SPAWN_H): Rename to a macro that
        depends on GUARD_PREFIX.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        signal-h: Support several gnulib-tool invocations better.
        * lib/signal.in.h (_GL_ALREADY_INCLUDING_SIGNAL_H): Rename to a macro
        that depends on GUARD_PREFIX.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        pthread-h: Support several gnulib-tool invocations better.
        * lib/pthread.in.h (_GL_ALREADY_INCLUDING_PTHREAD_H): Rename to a macro
        that depends on GUARD_PREFIX.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        malloc-h: Support several gnulib-tool invocations better.
        * lib/malloc.in.h (_GL_ALREADY_INCLUDING_MALLOC_H): Rename to a macro
        that depends on GUARD_PREFIX.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        locale: Support several gnulib-tool invocations better.
        * lib/locale.in.h (_GL_ALREADY_INCLUDING_LOCALE_H): Rename to a macro
        that depends on GUARD_PREFIX.
        (struct lconv): Avoid duplicate definition.

2024-12-24  Bruno Haible  <bruno@clisp.org>

        limits-h: Support several gnulib-tool invocations better.
        * lib/limits.in.h (_GL_ALREADY_INCLUDING_LIMITS_H): Rename to a macro
        that depends on GUARD_PREFIX.

Attachment: 0001-limits-h-Support-several-gnulib-tool-invocations-bet.patch
Description: Text Data

Attachment: 0002-locale-Support-several-gnulib-tool-invocations-bette.patch
Description: Text Data

Attachment: 0003-malloc-h-Support-several-gnulib-tool-invocations-bet.patch
Description: Text Data

Attachment: 0004-pthread-h-Support-several-gnulib-tool-invocations-be.patch
Description: Text Data

Attachment: 0005-signal-h-Support-several-gnulib-tool-invocations-bet.patch
Description: Text Data

Attachment: 0006-spawn-Support-several-gnulib-tool-invocations-better.patch
Description: Text Data

Attachment: 0007-stdio-Support-several-gnulib-tool-invocations-better.patch
Description: Text Data

Attachment: 0008-string-Support-several-gnulib-tool-invocations-bette.patch
Description: Text Data

Attachment: 0009-sys_socket-Support-several-gnulib-tool-invocations-b.patch
Description: Text Data

Attachment: 0010-threads-h-Support-several-gnulib-tool-invocations-be.patch
Description: Text Data

Attachment: 0011-wchar-Support-several-gnulib-tool-invocations-better.patch
Description: Text Data


reply via email to

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