aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-12-07 11:00:02 +0000
committerJonathan Wakely <jwakely@redhat.com>2023-12-07 20:54:11 +0000
commit2f512f6fcdd55296daff3e01a250d866491014e6 (patch)
tree0f4904be2e3be76ff0adcbe53cac224165f60384
parent1395c573c523762957bde8c2a08832c5f4350815 (diff)
downloadgcc-2f512f6fcdd55296daff3e01a250d866491014e6.zip
gcc-2f512f6fcdd55296daff3e01a250d866491014e6.tar.gz
gcc-2f512f6fcdd55296daff3e01a250d866491014e6.tar.bz2
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>.
-rw-r--r--libstdc++-v3/include/bits/atomic_wait.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h
index 1460b1d..8e01a9c 100644
--- a/libstdc++-v3/include/bits/atomic_wait.h
+++ b/libstdc++-v3/include/bits/atomic_wait.h
@@ -35,7 +35,7 @@
#include <bits/version.h>
#if __glibcxx_atomic_wait
-#include <stdint.h>
+#include <cstdint>
#include <bits/functional_hash.h>
#include <bits/gthr.h>
#include <ext/numeric_traits.h>