From 84be07a71d5002585ac714a892bbfd57f3091b4e Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 20 Mar 2023 00:35:55 +0000 Subject: gentoo auto-resync : 20:03:2023 - 00:35:55 --- sys-devel/gdb/Manifest | 3 +- ...b-13.1-Wenum-constexpr-conversion-clang16.patch | 128 +++++++++++++++++++++ sys-devel/gdb/gdb-13.1-r1.ebuild | 1 + 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 sys-devel/gdb/files/gdb-13.1-Wenum-constexpr-conversion-clang16.patch (limited to 'sys-devel/gdb') diff --git a/sys-devel/gdb/Manifest b/sys-devel/gdb/Manifest index de711c43bcc7..7ca5b862f7f4 100644 --- a/sys-devel/gdb/Manifest +++ b/sys-devel/gdb/Manifest @@ -1,12 +1,13 @@ AUX gdb-12.1-configure-clang16.patch 2893 BLAKE2B 15079fc458db3f57a99340800afccebb03a4d3067a9f14e44b8915588dc7c4f528047601d9c53257ea1e84a4b3b2eb17de08c43cc45334176e5cb37ccda0438e SHA512 c55b9afdaea5f482ceef34263b08ecda96109fa55208b2eca744734a29b4b364d44384e4e15b3a625fed6e781abe77775ead7773f1544371893f2a80ff2016d6 AUX gdb-12.1-core-file-detach.patch 5853 BLAKE2B 4442a9d6357f751f9953236a068ffc5e8a1f57eef1bf9e118d572614164486197db44cb6e5f1ab20906ae97ca1c4805a01ce5c2c3cbd1509bb383c108b6b8b1e SHA512 e044053dec340e6373b4a3546adf36ea121bb63a5277d6a1f24f5551edb0cf408f3f862076d6760b27501d54025063afd4a9375914c3f2321f5410466a89f75b AUX gdb-12.1-readline-8.2-build.patch 926 BLAKE2B f483dd1054b019d44dd4731ba22113551d3530a9da1af8c5e83aeae3ba820d96b8a1c2cb7758ecc3fbe8a56cdc7232cdece809d15c30dbfffadc30d81738a7ca SHA512 f865349953181fe3502abbe6042ebab249e2ebbc4c0017ebad756aadfd63e72f57b009fe2e7d036543f326e54518a656101bef572d03a7a7170c9ec305807ed8 +AUX gdb-13.1-Wenum-constexpr-conversion-clang16.patch 5795 BLAKE2B 22f8d242a13f7068ffe367d945be320e3f5e289adcfd60de24bcf53eb90a2b2334b7f3c71e3ab323064b64eb1a3b19f707fa70ab9e725d8391d05ea5d3e25035 SHA512 87c121615e6bf535c4a5988fcdc8214d8e2ddb6cd48eafd314ba963f57d9d1ac0f77b73e71e63e9cb16224d304b30baf78c7ef541b19f40b0dee796d3d640aef AUX gdb-8.3.1-verbose-build.patch 395 BLAKE2B e2e82307ceae64d16aa9b57a5e639eb5d217c4d977aed0847fdf125bb13ebc004906d9afb8e3f629c41efccca88df0040015e7799c1fd24de5fb50f62f5bbd90 SHA512 c2bb013e4fcabefddcd8042bd3cbb53471f83182cc8769fe0d19eed80ccc4a83bd84d120006fa25b3b7d0310dc2f2ec6b44a6ff74909cd312b7e491f371777a3 DIST gdb-12.1-patches-1.tar.xz 12340 BLAKE2B 071ff492f6cf7b0969d76db6f7414eeec564daf773c3334fb0d3f669e328bb4ae403ba8c709f3e33a56caa92273f762a5597a34dd7e7a1056f473b7ede2d8e59 SHA512 dc4a1a8d501dd1adfdcd6dcbd2559f1e2cc6aadeb18eacb2e9152f6858510e7392253db9568fe782da6d160221412e3e13dfd42a47a2a4a1addba2c1804a45b5 DIST gdb-12.1.tar.xz 22470332 BLAKE2B 7f6f853d1640908cf2c79932cdc1ba02549a07721c005d9c7ce2946a715761719cc164a4e68235a18664ec8a029afe3a2a0cfb57e1635f280076d6bed91317fd SHA512 425568d2e84672177d0fb87b1ad7daafdde097648d605e30cf0656970f66adc6a82ca2d83375ea4be583e9683a340e5bfdf5819668ddf66728200141ae50ff2d DIST gdb-13.1.tar.xz 23665472 BLAKE2B ab3a77ef35d21597dd1299787eebc422c3ca9764d0866223752c3036c0f9e198bf25ab4730bf6e7025bc2db148c66e98b191e15abc2d69c3088aed146728beef SHA512 e65054ffbc0357eeed4b17e1edc5ef45aa73c9ddf3b1210651e3d859576e27c1d27b266800fe26328eda58857455ccd8632f4000cfc5f63f90854096290187ca EBUILD gdb-12.1-r3.ebuild 8100 BLAKE2B 48a993f5a5319bb9326a1f045b4b4ca2706011f77a4c1ef96c135bff3aacf3a7b2e20862645f443f7558c405ea1864e2d8251407a5e208fce6817e0079c6cc50 SHA512 9519decae94744ffa27371879b222f21be38036b8b5642be4a37fc5d2930e2f92ede7373b0e56f66208d57a6d36b94762e9395cd42e89c55bfedc90f05bf0e98 EBUILD gdb-12.1-r4.ebuild 8352 BLAKE2B b70813155233f843c45cc853b4b1d5d14d9abc861fd9d244c67b14fe6e708cbc452fdc0064f8e0183c247c0c62ffb9e1390f843ad0b7344c75a177570a8fb4b5 SHA512 1d407f528c52b3b7930df48658d9c956fd7ff1416cb9e8ca01325febf689b69fbcffaa60fb55245a3e98de46c55a5390a5d63d3748be8da0b39a83a5519a42f6 -EBUILD gdb-13.1-r1.ebuild 8519 BLAKE2B f5ef2bff55dbee67a71100bb1e8bab0bb74698bbec93a5f12e65ed99ab4b6942e3b0ebef8488d35d8c410bea8cd083013ce0e9045590b37dafe0d9a5665d42f0 SHA512 bc9f0b32eb91be3983f896a2bc6266cf3168d4b47b1c492f80abca4b5fa44c13363f49e85e8f420ee41977e8c16f0d5aea238bd1553c540df5e2325ad6ba4bee +EBUILD gdb-13.1-r1.ebuild 8580 BLAKE2B d0f7ca6e6015b066b1b87d2c6b12fdf30d7775f925285659220fdfc39e0f236cc9a194300a886c800e2d5a028043d8e67fb1f446961b28e733e7e0430cee4747 SHA512 e7725dd0bfbffb46b14503d93a94c663b4b1c2f0590d80d0cdf2752bdd93c71c046f00e3d47d1393b9cf3c88b867c824fadeceb540081ddc251b9dbaef47050f EBUILD gdb-9999.ebuild 8519 BLAKE2B f5ef2bff55dbee67a71100bb1e8bab0bb74698bbec93a5f12e65ed99ab4b6942e3b0ebef8488d35d8c410bea8cd083013ce0e9045590b37dafe0d9a5665d42f0 SHA512 bc9f0b32eb91be3983f896a2bc6266cf3168d4b47b1c492f80abca4b5fa44c13363f49e85e8f420ee41977e8c16f0d5aea238bd1553c540df5e2325ad6ba4bee MISC metadata.xml 1242 BLAKE2B 368d8798d7d3b610653f635eb36ee5517912e8a2cb392622b32ac0aa90f336e3b391ba25811dee110644e50fabec0d64f6bcf3b219cdd240ec806e709a198eed SHA512 192fa340899680413c3d6c886ecd7d2262475a33aecc452192e5fe1d8e3eb5cf17546e57181e720128cf9b39cd8e4b1b1a73cb1f0c9887866c0ce88b288636e2 diff --git a/sys-devel/gdb/files/gdb-13.1-Wenum-constexpr-conversion-clang16.patch b/sys-devel/gdb/files/gdb-13.1-Wenum-constexpr-conversion-clang16.patch new file mode 100644 index 000000000000..adc09f83ea68 --- /dev/null +++ b/sys-devel/gdb/files/gdb-13.1-Wenum-constexpr-conversion-clang16.patch @@ -0,0 +1,128 @@ +https://bugs.gentoo.org/894174 +https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae61525fcf456ab395d55c45492a106d1275873a + +From ae61525fcf456ab395d55c45492a106d1275873a Mon Sep 17 00:00:00 2001 +From: Simon Marchi +Date: Thu, 23 Feb 2023 12:35:40 -0500 +Subject: [PATCH] gdbsupport: ignore -Wenum-constexpr-conversion in + enum-flags.h + +When building with clang 16, we get: + + CXX gdb.o + In file included from /home/smarchi/src/binutils-gdb/gdb/gdb.c:19: + In file included from /home/smarchi/src/binutils-gdb/gdb/defs.h:65: + /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion] + integer_for_size(T (-1) < T (0))>::type + ^ + +The error message does not make it clear in the context of which enum +flag this fails (i.e. what is T in this context), but it doesn't really +matter, we have similar warning/errors for many of them, if we let the +build go through. + +clang is right that the value -1 is invalid for the enum type we cast -1 +to. However, we do need this expression in order to select an integer +type with the appropriate signedness. That is, with the same signedness +as the underlying type of the enum. + +I first wondered if that was really needed, if we couldn't use +std::underlying_type for that. It turns out that the comment just above +says: + + /* Note that std::underlying_type is not what we want here, + since that returns unsigned int even when the enum decays to signed + int. */ + +I was surprised, because std::is_signed> +returns the right thing. So I tried replacing all this with +std::underlying_type, see if that would work. Doing so causes some +build failures in unittests/enum-flags-selftests.c: + + CXX unittests/enum-flags-selftests.o + /home/smarchi/src/binutils-gdb/gdb/unittests/enum-flags-selftests.c:254:1: error: static assertion failed due to requirement 'gdb::is_same, selftests::enum_flags_tests::RE, enum_flags, selftests::enum_flags_tests::RE2, enum_flags, selftests::enum_fla + gs_tests::URE, int>, selftests::enum_flags_tests::check_valid_expr254::archetype, selftests::enum_flags_tests::RE, enum_flags, selfte + sts::enum_flags_tests::RE2, enum_flags, selftests::enum_flags_tests::URE, unsigned int>>::value == true': + CHECK_VALID (true, int, true ? EF () : EF2 ()) + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /home/smarchi/src/binutils-gdb/gdb/unittests/enum-flags-selftests.c:91:3: note: expanded from macro 'CHECK_VALID' + CHECK_VALID_EXPR_6 (EF, RE, EF2, RE2, UEF, URE, VALID, EXPR_TYPE, EXPR) + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/valid-expr.h:105:3: note: expanded from macro 'CHECK_VALID_EXPR_6' + CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, \ + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/valid-expr.h:66:3: note: expanded from macro 'CHECK_VALID_EXPR_INT' + static_assert (gdb::is_detected_exact, \ + ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is a bit hard to decode, but basically enumerations have the +following funny property that they decay into a signed int, even if +their implicit underlying type is unsigned. This code: + + enum A {}; + enum B {}; + + int main() { + std::cout << std::is_signed::type>::value + << std::endl; + std::cout << std::is_signed::type>::value + << std::endl; + auto result = true ? A() : B(); + std::cout << std::is_signed::value << std::endl; + } + +produces: + + 0 + 0 + 1 + +So, the "CHECK_VALID" above checks that this property works for enum flags the +same way as it would if you were using their underlying enum types. And +somehow, changing integer_for_size to use std::underlying_type breaks that. + +Since the current code does what we want, and I don't see any way of doing it +differently, ignore -Wenum-constexpr-conversion around it. + +Change-Id: Ibc82ae7bbdb812102ae3f1dd099fc859dc6f3cc2 +--- a/gdbsupport/enum-flags.h ++++ b/gdbsupport/enum-flags.h +@@ -91,9 +91,12 @@ template<> struct integer_for_size<8, 1> { typedef int64_t type; }; + template + struct enum_underlying_type + { ++ DIAGNOSTIC_PUSH ++ DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION + typedef typename + integer_for_size(T (-1) < T (0))>::type + type; ++ DIAGNOSTIC_POP + }; + + namespace enum_flags_detail +--- a/include/diagnostics.h ++++ b/include/diagnostics.h +@@ -76,6 +76,11 @@ + # define DIAGNOSTIC_ERROR_SWITCH \ + DIAGNOSTIC_ERROR ("-Wswitch") + ++# if __has_warning ("-Wenum-constexpr-conversion") ++# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION \ ++ DIAGNOSTIC_IGNORE ("-Wenum-constexpr-conversion") ++# endif ++ + #elif defined (__GNUC__) /* GCC */ + + # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \ +@@ -155,4 +160,8 @@ + # define DIAGNOSTIC_ERROR_SWITCH + #endif + ++#ifndef DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION ++# define DIAGNOSTIC_IGNORE_ENUM_CONSTEXPR_CONVERSION ++#endif ++ + #endif /* DIAGNOSTICS_H */ +-- +2.31.1 diff --git a/sys-devel/gdb/gdb-13.1-r1.ebuild b/sys-devel/gdb/gdb-13.1-r1.ebuild index bc86849c6276..60adac18680f 100644 --- a/sys-devel/gdb/gdb-13.1-r1.ebuild +++ b/sys-devel/gdb/gdb-13.1-r1.ebuild @@ -101,6 +101,7 @@ BDEPEND=" PATCHES=( "${FILESDIR}"/${PN}-8.3.1-verbose-build.patch + "${FILESDIR}"/${P}-Wenum-constexpr-conversion-clang16.patch ) pkg_setup() { -- cgit v1.2.3