diff options
author | John Baldwin <jhb@FreeBSD.org> | 2022-05-23 11:02:55 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2022-05-23 11:02:55 -0700 |
commit | e8123c847f61c7458200b349615c47e9df17a0ed (patch) | |
tree | 133267c1a44bc96069d3dc78a2e199bff873572a | |
parent | d9b6e047f60ce2129eff28ad1c6690949293366b (diff) | |
download | binutils-gdb-e8123c847f61c7458200b349615c47e9df17a0ed.tar.gz |
Tweak the std::hash<> specialization for aarch64_features.
Move the specialization into an explicit std namespace to workaround a
bug in older compilers. GCC 6.4.1 at least fails to compile the previous
version with the following error:
gdb/arch/aarch64.h:48:13: error: specialization of 'template<class _Tp> struct std::hash' in different namespace [-fpermissive]
struct std::hash<aarch64_features>
-rw-r--r-- | gdb/arch/aarch64.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h index 72ec4193eba..8e3fd36726a 100644 --- a/gdb/arch/aarch64.h +++ b/gdb/arch/aarch64.h @@ -44,20 +44,23 @@ inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs) && lhs.tls == rhs.tls; } -template<> -struct std::hash<aarch64_features> +namespace std { - std::size_t operator()(const aarch64_features &features) const noexcept + template<> + struct hash<aarch64_features> { - std::size_t h; - - h = features.vq; - h = h << 1 | features.pauth; - h = h << 1 | features.mte; - h = h << 1 | features.tls; - return h; - } -}; + std::size_t operator()(const aarch64_features &features) const noexcept + { + std::size_t h; + + h = features.vq; + h = h << 1 | features.pauth; + h = h << 1 | features.mte; + h = h << 1 | features.tls; + return h; + } + }; +} /* Create the aarch64 target description. */ |