public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-8138] libstdc++: Use <cstdint> instead of <stdint.h> in <bits/atomic_wait.h> Date: Sat, 9 Dec 2023 22:04:45 +0000 (GMT) [thread overview] Message-ID: <20231209220445.2D5D53858C98@sourceware.org> (raw) https://gcc.gnu.org/g:d62feab6aa7d023f7ba916f1618b8a6137ac5659 commit r13-8138-gd62feab6aa7d023f7ba916f1618b8a6137ac5659 Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu Dec 7 11:00:02 2023 +0000 libstdc++: Use <cstdint> instead of <stdint.h> in <bits/atomic_wait.h> In r14-5922-g6c8f2d3a08bc01 I added <stdint.h> to <bits/atomic_wait.h>, so that uintptr_t is declared if that header is compiled as a header unit. I used <stdint.h> because that's what <atomic> already includes, so it seemed simpler to be consistent. However, this means that name lookup for uintptr_t in <bits/atomic_wait.h> depends on whether <cstdint> has been included by another header first. Whether name lookup finds std::uintptr_t or ::uintptr_t will depend on include order. This causes problems when compiling modules with Clang: bits/atomic_wait.h:251:7: error: 'std::__detail::__waiter_pool_base' has different definitions in different modules; first difference is defined here found method '_S_for' with body _S_for(const void* __addr) noexcept ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bits/atomic_wait.h:251:7: note: but in 'tm.<global>' found method '_S_for' with different body _S_for(const void* __addr) noexcept ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By including <cstdint> we would ensure that name lookup always finds the name in namespace std. Alternatively, we can stop including <stdint.h> for those types, so that we don't declare the entire contents of <stdint.h> when we only need a couple of types from it. This patch does the former, which is appropriate for backporting. libstdc++-v3/ChangeLog: * include/bits/atomic_wait.h: Include <cstdint> instead of <stdint.h>. (cherry picked from commit 2f512f6fcdd55296daff3e01a250d866491014e6) Diff: --- libstdc++-v3/include/bits/atomic_wait.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h index aaf36832ea3..fc840578c22 100644 --- a/libstdc++-v3/include/bits/atomic_wait.h +++ b/libstdc++-v3/include/bits/atomic_wait.h @@ -34,7 +34,7 @@ #include <bits/c++config.h> #if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX -#include <stdint.h> +#include <cstdint> #include <bits/functional_hash.h> #include <bits/gthr.h> #include <ext/numeric_traits.h>
reply other threads:[~2023-12-09 22:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231209220445.2D5D53858C98@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).