Remove #ifdef from cooked-index-entry.c
Checks
Commit Message
cooked-index-entry.c has an #ifdef to work around a GCC 7.5.0 bug.
However, the workaround just removes a 'constexpr' which is not
needed. The constexpr behavior was desirable in the past, but this
changed with commit 8cbf7d2a ("gdb/dwarf: remove unnecessary
comparison in cooked_index_entry::compare").
This removes the #ifdef and the constexpr.
---
gdb/dwarf2/cooked-index-entry.c | 5 -----
1 file changed, 5 deletions(-)
base-commit: aeed64b39aed57729f66ad51560d8964e8201e6e
Comments
On 10/28/26 1:23 PM, Tom Tromey wrote:
> cooked-index-entry.c has an #ifdef to work around a GCC 7.5.0 bug.
> However, the workaround just removes a 'constexpr' which is not
> needed. The constexpr behavior was desirable in the past, but this
> changed with commit 8cbf7d2a ("gdb/dwarf: remove unnecessary
> comparison in cooked_index_entry::compare").
>
> This removes the #ifdef and the constexpr.
Nit: it's an #if, not an #ifdef.
For my curiosity, can you explain why constexpr was needed (or useful) in the first place?
The commit that added it is:
https://gitlab.com/gnutools/binutils-gdb/-/commit/2e724489260d02a528591eaea4710ce5aeeee0e8
but it doesn't talk about that.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Thanks,
Simon
Simon> For my curiosity, can you explain why constexpr was needed (or
Simon> useful) in the first place?
I added a note to the commit message but basically:
Simon> The commit that added it is:
Simon> https://gitlab.com/gnutools/binutils-gdb/-/commit/2e724489260d02a528591eaea4710ce5aeeee0e8
Simon> but it doesn't talk about that.
... the old code called "munge ('<')" which is a constant.
Though perhaps that was wishful thinking and/or maybe an older patch did
something else.
Tom
@@ -47,12 +47,7 @@ int
cooked_index_entry::compare (const char *stra, const char *strb,
comparison_mode mode)
{
-#if defined (__GNUC__) && !defined (__clang__) && __GNUC__ <= 7
- /* Work around error with gcc 7.5.0. */
auto munge = [] (char c) -> unsigned char
-#else
- auto munge = [] (char c) constexpr -> unsigned char
-#endif
{
/* Treat '<' as if it ended the string. This lets something
like "func<t>" match "func<t<int>>". See the "Breakpoints in