From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 52F853858C5F; Fri, 13 Sep 2024 20:59:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52F853858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1726261153; bh=WVh9EbqG4MuMiO2hX0C01ygEdpQ3hGIJPIlLrhM2yuU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ulWnVamrc+gYfjuZqR4jVCQ+wlhv48VM6fCu+NFFgIiFzVv4DSIscVg7M09BDHtNa zsSTgvfH2at/V9LtlAUGJN++ABr70+0YykWCYfvNwpghB3RjvjroOkKTnj2TiArf7/ StzpuXEbai63ThPKNVtKsn2NWu7voIKC2wVMP+3I= From: "bruno at clisp dot org" To: glibc-bugs@sourceware.org Subject: [Bug libc/32024] sys/un.h includes header files within extern "C++" { ... } Date: Fri, 13 Sep 2024 20:59:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: 2.40 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bruno at clisp dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D32024 --- Comment #4 from Bruno Haible --- (In reply to Andreas Schwab from comment #3) > __BEGIN_DECLS is defined to extern "C", not extern "C++" Indeed, I should have written extern "C" instead of extern "C++" in the bug description. > so I don't see how that can result in misbehaviour. Here's a minified test case: 1. Store the attached test.cc and string.h in the same directory. 2. Compile test.cc with clang (I use clang 18): $ clang++ -I. -c test.cc In file included from test.cc:5: In file included from /usr/include/x86_64-linux-gnu/sys/un.h:37: ./string.h:6:15: error: declaration of 'memchr' has a different language linkage 6 | extern void * memchr (void *__s, int __c, size_t __n) noexcept (tru= e) | ^ /usr/include/string.h:87:14: note: previous declaration is here 87 | extern void *memchr (void *__s, int __c, size_t __n) | ^ In file included from test.cc:5: In file included from /usr/include/x86_64-linux-gnu/sys/un.h:37: ./string.h:8:21: error: declaration of 'memchr' has a different language linkage 8 | extern void const * memchr (void const *__s, int __c, size_t __n) noexcept (true) | ^ /usr/include/string.h:89:20: note: previous declaration is here 89 | extern const void *memchr (const void *__s, int __c, size_t __n) | ^ 2 errors generated. 3. Compile test.cc with clang, this time defining WORKAROUND to 1: $ clang++ -I. -c test.cc -DWORKAROUND (no errors) --=20 You are receiving this mail because: You are on the CC list for the bug.=