Bruno Haible <br...@clisp.org> writes:

> Forgot to say: The continuous integration uses a testdir of all modules.
> But probably a testdir of 'sys_un' and 'memchr' will be sufficient to
> reproduce it.

Thanks, that reproduces it on my Fedora 40 machine.

I had assumed GNULIB_NAMESPACE was supposed to be defined in C++ tests.
Is that incorrect? I don't know C++ namespaces much.

Here is some expirementation I did. Using the following testdir:

    $ gnulib-tool --create-testdir --with-all-tests --dir testdir sys_un memchr

Using gcc and g++ on master:

    # gcc version 14.1.1 20240701 (Red Hat 14.1.1-7) (GCC)
    $ ./configure
    $ make
    [...]
    $ echo $?
    0
    
After removing the GNULIB_NAMESPACE definition in
gltests/test-sys_un-c++.cc:

    # gcc version 14.1.1 20240701 (Red Hat 14.1.1-7) (GCC)
    $ ./configure
    $ make
    [...]
    $ echo $?
    0

Using clang and clang++ on master:

    # clang version 18.1.6 (Fedora 18.1.6-3.fc40)
    $ ./configure CC='clang' CXX='clang++'
    $ make
    [...]
    In file included from test-sys_un-c++.cc:24:
    In file included from /usr/include/sys/un.h:38:
    ../gllib/string.h:809:20: error: declaration of 'memchr' has a different 
language linkage
      809 | _GL_CXXALIASWARN1 (memchr, void *,
          |                    ^
    /usr/include/string.h:94:1: note: previous definition is here
       94 | memchr (void *__s, int __c, size_t __n) __THROW
          | ^
    In file included from test-sys_un-c++.cc:24:
    In file included from /usr/include/sys/un.h:38:
    ../gllib/string.h:812:20: error: declaration of 'memchr' has a different 
language linkage
      812 | _GL_CXXALIASWARN1 (memchr, void const *,
          |                    ^
    /usr/include/string.h:100:1: note: previous definition is here
      100 | memchr (const void *__s, int __c, size_t __n) __THROW
          | ^
    2 errors generated.
    make[4]: *** [Makefile:1958: test-sys_un-c++.o] Error 1
    $ echo $?
    2

After removing the GNULIB_NAMESPACE definition in
gltests/test-sys_un-c++.cc:

    # clang version 18.1.6 (Fedora 18.1.6-3.fc40)
    $ ./configure CC='clang' CXX='clang++'
    $ make
    [...]
    $ echo $?
    0

Collin

Reply via email to