diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-03-17 06:26:48 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-03-17 06:26:48 +0000 |
commit | 2e0bf408961ec1023d3db1fc5d687c233661ac26 (patch) | |
tree | 96c6e46af3c356d1fb470acdf72ada482bb293f8 /dev-libs/glib | |
parent | 48dbe17904ac8ee6f006488d8f21734b0d253db4 (diff) |
gentoo auto-resync : 17:03:2023 - 06:26:48
Diffstat (limited to 'dev-libs/glib')
-rw-r--r-- | dev-libs/glib/Manifest | 3 | ||||
-rw-r--r-- | dev-libs/glib/files/glib-2.76.0-g_strdup-c++.patch | 132 | ||||
-rw-r--r-- | dev-libs/glib/glib-2.76.0-r1.ebuild (renamed from dev-libs/glib/glib-2.76.0.ebuild) | 1 |
3 files changed, 135 insertions, 1 deletions
diff --git a/dev-libs/glib/Manifest b/dev-libs/glib/Manifest index b053ca950321..1cb9aded27cc 100644 --- a/dev-libs/glib/Manifest +++ b/dev-libs/glib/Manifest @@ -1,9 +1,10 @@ AUX glib-2.64.1-mark-gdbus-server-auth-test-flaky.patch 842 BLAKE2B 6b2eb57b8923c8bb54ead80d829aeb7a5c8a42c62e960e7305bc3fad69c67fd21e1c9f20b5c9002c0319cf3d77992b9cb71912c9b813b723e0a56aaea38330ad SHA512 ccd92d2f1fd495618ac788ffe6b69acec05a521a0ee8ff2bacb1dce6e283a04bbc2a10e61b37fc29f3893003fa154fa0d30bc37ed266b3f813200cd8ed17c116 AUX glib-2.74.5-tests-Skip-assert-msg-test.py-if-gdb-fails.patch 1356 BLAKE2B 42f485dcf2de7dc8a47285eaad083d7d9fe12a8e0b50f65b8093e8046621f371797b3c57ea308f5a99a8db60d103e72fb475256f991b3a894728f30a3e62acef SHA512 a63ad5c2d765bd67ca85455c9cff4859832676a821b4aa438c98cd3ecb9854138f5a26538a6e4d3e542dba1e53cf4114f3dc8e481ff0db00ac27340fa9a57f4e +AUX glib-2.76.0-g_strdup-c++.patch 4895 BLAKE2B 2683c68391b6da3631e0e52b939a6a9e8a6c5cf9cff54b846adb6f31f86f8f73a78ab7ef1de0adeb1652fbfe3621ac894f1da61e4db595385a5561d24fa25688 SHA512 c90de1d52ad1b0f24c4a937618dab5daab6db0c9a0f7c32f9ef9cafea24f99ade590f1fcb7a0b3aa26cf60204b932816af8a3c9da32928e5bb0e543965441663 DIST glib-2.74.5.tar.xz 5211852 BLAKE2B 5bf0069cbf949a946357127682e4f687c7e7b8565037024a232b3e905e65bebb86d016832b6274f743005ec8fe5fcd31eaf99ccece82d9d7c3f924d17502c409 SHA512 2716e0fe984cc5d0714e91fe0de47ee71a8bd0b4c85caee337ddb7e02ac2fb3c8c007ccc1207b29cf901c30a7ec8e3bcca75d69c6fab2a32a8cf14bff974e614 DIST glib-2.74.6.tar.xz 5217312 BLAKE2B 07b0a5cb74c1451ba863d5f9a781a122d3d20af1f1227177025de114279277cacada3dd6ab5eb5ad5c0bff5ac7abab6fdfbe0551f44d07b2ddc9141a0640a8c8 SHA512 6b6d113012ec90f6cf77513ec0132668c49aa7224c806181ad662388701004667cdf6d263050d6f896b8688c085abf461aa3e659eb288e6ba93ba4970a2f181b DIST glib-2.76.0.tar.xz 5268620 BLAKE2B 74bfba6254787b6b386161c329899fe6a53c87290261866f8aceb6e23ebf0bcacd085b04f480a7297d6fc11d37a676fb2fad5661e9f2668ae81f872ff5e2054f SHA512 812834ca6d840dd9c15c0689685d8bd96f4acd69a89213f807a75732d1aa5efadbed0e0073f05a56a09beb2d4f0be1b83a4642259682aac84302632da2d62370 EBUILD glib-2.74.5.ebuild 10277 BLAKE2B 7fb6b90b3dcbeced1cb8a9258279b257fe880072a8844b84b2062766e5d82c2ff2aef141fbb29de0031ffa87c795dc5d6ff62a06f62ae2520880db20eafc0302 SHA512 5d93a71115aab66c0b465221fff9dd18b4580ce58b2aeb677d9dd67e284d5a475f4f373ebea5e52eb78771f0c77574b5843a27e402fa06832fba481ebf613e8e EBUILD glib-2.74.6.ebuild 10215 BLAKE2B a771708382538aad6fce9c6ff14183e505b3d5c7e2d836dc5491484af9109a723278bc720edc55a76e64ceb57aa947a1020dc7479401accba2fb994b4af76e1a SHA512 a2ed96db33cefa8bad4096b1307ba0fc02e09532010e4263ec7f5786f2468612473870d76aca67bbf49af13d654cd3af860b5cd6559177ed67774a3d4153bf15 -EBUILD glib-2.76.0.ebuild 10120 BLAKE2B 039ab33510d6340059027f16f80c75b05e030ed7b1a772c58da32b8f4e886dfc9f3a7687e5901d3762dd3c70f44f13d1ab612b37148ab9b48c76ddba32bf5d41 SHA512 2b8596225b27c912366570ac05913b5a9ce6534977db1b67fac8cb44defb167e203c1deb1aca59fe0479984e99e9be3f8b8bc957f3e8b84e793063a3de338e39 +EBUILD glib-2.76.0-r1.ebuild 10167 BLAKE2B 29cf6c7a855cf157cba5e90af85523b958818cc3a06161550de3eea88afef539f10eebd0b7b18bb0344bde3da68abec892a92dfe1f0c9f2ff8bd02558e822751 SHA512 a552f857b40430a288642d5c17b45150717275fc8a9939758b5ae9c3d31b72907dc64fef86bcf9f45e438fe448539a6ba72585e532fa21499f74eebd075ea834 MISC metadata.xml 1357 BLAKE2B c9236f5cdb72931175f757cd7b713d924655cbbdbba9a45479564a2fb8f73b490923d62b69e84568dcd8cd47df32f9fa1dd51481c332a85713c17ce6f6af5109 SHA512 6fc9c503e81c78e21904f74cedb9dbce10194b7acaecf3f17098749e33ca2513a96a53142bc8c1d9d196e48d62b8752956c30d4813ac34d0616cdf13de37b33b diff --git a/dev-libs/glib/files/glib-2.76.0-g_strdup-c++.patch b/dev-libs/glib/files/glib-2.76.0-g_strdup-c++.patch new file mode 100644 index 000000000000..23b0a1b641c1 --- /dev/null +++ b/dev-libs/glib/files/glib-2.76.0-g_strdup-c++.patch @@ -0,0 +1,132 @@ +https://bugs.gentoo.org/901035 +https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3322 +https://gitlab.gnome.org/GNOME/glib/-/commit/cc7f2f81cc59751fcc689731dcd60af5da5723ba + +From cc7f2f81cc59751fcc689731dcd60af5da5723ba Mon Sep 17 00:00:00 2001 +From: Xi Ruoyao <xry111@xry111.site> +Date: Mon, 13 Mar 2023 16:23:37 +0800 +Subject: [PATCH] gstrfuncs: Improve inline version of g_strdup() to avoid + breaking C++ code + +Wrap the logic into a G_ALWAYS_INLINE function, instead of using a +complex statement-expression which is not allowed in braced initializer +lists and expanded into some bad thing when it's used as +`::g_strdup(...)`. + +We cannot use `__builtin_constant_p (str)` because GCC documentation +clearly states that it always produces 0 when str is a const char * +argument of an inline function. But `__builtin_constant_p (!str)`, +`__builtin_constant_p (!!str)`, and +`__builtin_constant_p (strlen (str))` functions properly with `-O1` or +above enabled. + +Fixes #2936. +--- a/glib/gstrfuncs.h ++++ b/glib/gstrfuncs.h +@@ -204,23 +204,6 @@ gboolean (g_str_has_prefix) (const gchar *str, + (g_str_has_suffix) (STR, SUFFIX) \ + ) + +-#define g_strdup(STR) \ +- (__builtin_constant_p ((STR)) ? \ +- (G_LIKELY ((STR) != NULL) ? \ +- G_GNUC_EXTENSION ({ \ +- const char *const ___str = ((STR)); \ +- const char *const __str = _G_STR_NONNULL (___str); \ +- const size_t __str_len = strlen (__str) + 1; \ +- char *__dup_str = (char *) g_malloc (__str_len); \ +- (char *) memcpy (__dup_str, __str, __str_len); \ +- }) \ +- : \ +- (char *) (NULL) \ +- ) \ +- : \ +- (g_strdup) ((STR)) \ +- ) +- + #endif /* !defined (__GI_SCANNER__) */ + #endif /* !defined (__GTK_DOC_IGNORE__) */ + #endif /* G_GNUC_CHECK_VERSION (2, 0) */ +@@ -318,6 +301,32 @@ GLIB_AVAILABLE_IN_ALL + gchar* g_strjoin (const gchar *separator, + ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED; + ++#if G_GNUC_CHECK_VERSION(2, 0) ++#ifndef __GTK_DOC_IGNORE__ ++#ifndef __GI_SCANNER__ ++ ++G_ALWAYS_INLINE static inline char * ++g_strdup_inline (const char *str) ++{ ++ if (__builtin_constant_p (!str) && !str) ++ return NULL; ++ ++ if (__builtin_constant_p (!!str) && !!str && __builtin_constant_p (strlen (str))) ++ { ++ const size_t len = strlen (str) + 1; ++ char *dup_str = (char *) g_malloc (len); ++ return (char *) memcpy (dup_str, str, len); ++ } ++ ++ return g_strdup (str); ++} ++ ++#define g_strdup(x) g_strdup_inline (x) ++ ++#endif /* !defined (__GI_SCANNER__) */ ++#endif /* !defined (__GTK_DOC_IGNORE__) */ ++#endif /* G_GNUC_CHECK_VERSION (2, 0) */ ++ + /* Make a copy of a string interpreting C string -style escape + * sequences. Inverse of g_strescape. The recognized sequences are \b + * \f \n \r \t \\ \" and the octal format. +--- a/glib/tests/cxx.cpp ++++ b/glib/tests/cxx.cpp +@@ -349,6 +349,36 @@ test_strdup_macro (void) + g_free (str); + } + ++static void ++test_strdup_macro_qualified (void) ++{ ++ gchar *str; ++ ++ g_assert_null (::g_strdup (NULL)); ++ ++ str = ::g_strdup ("C++ is cool too!"); ++ g_assert_nonnull (str); ++ g_assert_cmpstr (str, ==, "C++ is cool too!"); ++ g_free (str); ++} ++ ++static void ++test_strdup_macro_nested_initializer (void) ++{ ++ struct ++ { ++ char *p, *q; ++ } strings = { ++ g_strdup (NULL), ++ g_strdup ("C++ is cool too!"), ++ }; ++ ++ g_assert_null (strings.p); ++ g_assert_nonnull (strings.q); ++ g_assert_cmpstr (strings.q, ==, "C++ is cool too!"); ++ g_free (strings.q); ++} ++ + static void + test_str_has_prefix (void) + { +@@ -527,6 +557,8 @@ main (int argc, char *argv[]) + g_test_add_func ("/C++/str-equal", test_str_equal); + g_test_add_func ("/C++/strdup", test_strdup); + g_test_add_func ("/C++/strdup/macro", test_strdup_macro); ++ g_test_add_func ("/C++/strdup/macro/qualified", test_strdup_macro_qualified); ++ g_test_add_func ("/C++/strdup/macro/nested-initializer", test_strdup_macro_nested_initializer); + g_test_add_func ("/C++/str-has-prefix", test_str_has_prefix); + g_test_add_func ("/C++/str-has-prefix/macro", test_str_has_prefix_macro); + g_test_add_func ("/C++/str-has-suffix", test_str_has_suffix); +-- +GitLab diff --git a/dev-libs/glib/glib-2.76.0.ebuild b/dev-libs/glib/glib-2.76.0-r1.ebuild index 11eedb4e806c..56112f34dd89 100644 --- a/dev-libs/glib/glib-2.76.0.ebuild +++ b/dev-libs/glib/glib-2.76.0-r1.ebuild @@ -69,6 +69,7 @@ MULTILIB_CHOST_TOOLS=( PATCHES=( "${FILESDIR}"/${PN}-2.64.1-mark-gdbus-server-auth-test-flaky.patch + "${FILESDIR}"/${PN}-2.76.0-g_strdup-c++.patch ) pkg_setup() { |