devel/gdb: fix build with clang 21
Compiling devel/gdb with clang 21 results in errors similar to:
/wrkdirs/usr/ports/devel/gdb/work-py311/gdb-15.1/gdb/../gdbsupport/enum-flags.h:97:34: error: non-type template argument is not a constant expression
97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/gdb/work-py311/gdb-15.1/gdb/../gdbsupport/enum-flags.h:134:20: note: in instantiation of template class 'enum_underlying_type<ui_out_flag>' requested here
134 | typedef typename enum_underlying_type<enum_type>::type underlying_type;
| ^
/wrkdirs/usr/ports/devel/gdb/work-py311/gdb-15.1/gdb/ui-out.h:385:16: note: in instantiation of template class 'enum_flags<ui_out_flag>' requested here
385 | ui_out_flags m_flags;
| ^
/wrkdirs/usr/ports/devel/gdb/work-py311/gdb-15.1/gdb/../gdbsupport/enum-flags.h:97:52: note: integer value -1 is outside the valid range of values [0, 15] for the enumeration type 'ui_out_flag'
97 | integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
| ^This is because enum-flags.h does some trickery with casting enum values
to -1 to determine whether the underlying type is signed or not, as part
of its custom template to determine the actual underlying type.
It only works because -Wenum-constexpr-conversion is suppressed for this
part, but newer versions of clang turn the warning into a hard error.
Upstream had https://sourceware.org/bugzilla/show_bug.cgi?id=31331 for
this problem. Pull in the patch for it, plus two prerequisites.
PR: 292054
Approved by: maintainer timeout (2 weeks)
MFH: 2026Q1
(cherry picked from commit ba93f97b60a17df89c7cce53200b53c9da0428f1)