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.
Created attachment 266660 [details] devel/gdb: fix build with clang 21
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=ba93f97b60a17df89c7cce53200b53c9da0428f1 commit ba93f97b60a17df89c7cce53200b53c9da0428f1 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2025-12-30 21:13:17 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2026-01-14 19:01:02 +0000 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 ...atch-gdb-15-branchpoint-0753-gb050b744be4 (new) | 94 +++++ ...atch-gdb-15-branchpoint-0754-gba96d2e697a (new) | 460 +++++++++++++++++++++ ...atch-gdb-15-branchpoint-1903-g4a0b2cb7210 (new) | 317 ++++++++++++++ 3 files changed, 871 insertions(+)
A commit in branch 2026Q1 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=26b978c64c9d32be6e74d02873e6c2a2d0cd6565 commit 26b978c64c9d32be6e74d02873e6c2a2d0cd6565 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2025-12-30 21:13:17 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2026-01-14 19:01:59 +0000 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) ...atch-gdb-15-branchpoint-0753-gb050b744be4 (new) | 94 +++++ ...atch-gdb-15-branchpoint-0754-gba96d2e697a (new) | 460 +++++++++++++++++++++ ...atch-gdb-15-branchpoint-1903-g4a0b2cb7210 (new) | 317 ++++++++++++++ 3 files changed, 871 insertions(+)