Remove std::hash specialization
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
C++11 initially omitted specialization of std::hash for enumeration
types, but this was rectified in LWG issue 2148. This patch removes a
redundant specialization. Tested by rebuilding.
---
gdb/dictionary.c | 17 -----------------
1 file changed, 17 deletions(-)
Comments
On 2025-03-13 16:28, Tom Tromey wrote:
> C++11 initially omitted specialization of std::hash for enumeration
> types, but this was rectified in LWG issue 2148. This patch removes a
> redundant specialization. Tested by rebuilding.
Does this work with the oldest compiler we want to support (I don't
recall which version it is now)?
If so, it seems like a trivial change.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
Simon> On 2025-03-13 16:28, Tom Tromey wrote:
>> C++11 initially omitted specialization of std::hash for enumeration
>> types, but this was rectified in LWG issue 2148. This patch removes a
>> redundant specialization. Tested by rebuilding.
Simon> Does this work with the oldest compiler we want to support (I don't
Simon> recall which version it is now)?
I don't know. However since gdb relies on C++17 and this was a
11/14-ish era feature (I believe), I think we should go ahead anyway.
Worst case, we will get a report and then I can back out the patch.
Tom
On 3/14/25 10:31 AM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
>
> Simon> On 2025-03-13 16:28, Tom Tromey wrote:
>>> C++11 initially omitted specialization of std::hash for enumeration
>>> types, but this was rectified in LWG issue 2148. This patch removes a
>>> redundant specialization. Tested by rebuilding.
>
> Simon> Does this work with the oldest compiler we want to support (I don't
> Simon> recall which version it is now)?
>
> I don't know. However since gdb relies on C++17 and this was a
> 11/14-ish era feature (I believe), I think we should go ahead anyway.
> Worst case, we will get a report and then I can back out the patch.
>
> Tom
Ah nevermind, in my mind for a moment I thought we were still on C++11.
There is already a precedent:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=8675d15227529517e0a7e78e1524ad9cc76afc14
So:
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
@@ -915,23 +915,6 @@ struct multidictionary
unsigned short n_allocated_dictionaries;
};
-/* A hasher for enum language. Injecting this into std is a convenience
- when using unordered_map with C++11. */
-
-namespace std
-{
- template<> struct hash<enum language>
- {
- typedef enum language argument_type;
- typedef std::size_t result_type;
-
- result_type operator() (const argument_type &l) const noexcept
- {
- return static_cast<result_type> (l);
- }
- };
-} /* namespace std */
-
/* A helper function to collate symbols on the pending list by language. */
static std::unordered_map<enum language, std::vector<symbol *>>