summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-05-05 06:08:19 +0100
committerSam James <sam@gentoo.org>2023-05-05 06:08:19 +0100
commit365603f75e075df14603daa916aceb3d9519f3cd (patch)
tree9268c37c8b721b0abb9483a62f8c603c4530237b /gnome-extra
parentdev-python/pycairo: fix build w/ USE=doc (diff)
downloadgentoo-365603f75e075df14603daa916aceb3d9519f3cd.tar.gz
gentoo-365603f75e075df14603daa916aceb3d9519f3cd.tar.bz2
gentoo-365603f75e075df14603daa916aceb3d9519f3cd.zip
gnome-extra/cjs: fix build w/ clang 15
Closes: https://bugs.gentoo.org/905430 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'gnome-extra')
-rw-r--r--gnome-extra/cjs/cjs-5.6.1.ebuild4
-rw-r--r--gnome-extra/cjs/files/cjs-5.6.1-clang15.patch50
2 files changed, 54 insertions, 0 deletions
diff --git a/gnome-extra/cjs/cjs-5.6.1.ebuild b/gnome-extra/cjs/cjs-5.6.1.ebuild
index e30a52266004..25a3e01843cd 100644
--- a/gnome-extra/cjs/cjs-5.6.1.ebuild
+++ b/gnome-extra/cjs/cjs-5.6.1.ebuild
@@ -38,6 +38,10 @@ BDEPEND="
virtual/pkgconfig
"
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.6.1-clang15.patch
+)
+
src_prepare() {
default
python_fix_shebang build
diff --git a/gnome-extra/cjs/files/cjs-5.6.1-clang15.patch b/gnome-extra/cjs/files/cjs-5.6.1-clang15.patch
new file mode 100644
index 000000000000..43439e6f2c2a
--- /dev/null
+++ b/gnome-extra/cjs/files/cjs-5.6.1-clang15.patch
@@ -0,0 +1,50 @@
+https://bugs.gentoo.org/905430
+https://github.com/linuxmint/cjs/issues/115
+https://gitlab.gnome.org/GNOME/gjs/-/issues/514
+https://gitlab.gnome.org/GNOME/gjs/-/commit/9b11ed0ba70718a8b1983126563cea58658a808f
+
+From f93880c356108cfdbc8f9ebe318d18f256d7128d Mon Sep 17 00:00:00 2001
+From: Philip Chimento <philip.chimento@gmail.com>
+Date: Sat, 5 Nov 2022 18:01:36 -0700
+Subject: [PATCH] tests: Avoid using char type in uniform_int_distribution<T>
+ template
+
+This is undefined behaviour. GCC and pre-15.x Clang accept it, so we
+didn't notice it before.
+
+Closes: #514
+--- a/test/gjs-tests.cpp
++++ b/test/gjs-tests.cpp
+@@ -55,12 +55,30 @@ static unsigned cpp_random_seed = 0;
+
+ using Gjs::Test::assert_equal;
+
++template <typename T>
++struct is_char_helper : public std::false_type {};
++template <>
++struct is_char_helper<char> : public std::true_type {};
++template <>
++struct is_char_helper<wchar_t> : public std::true_type {};
++template <>
++struct is_char_helper<char16_t> : public std::true_type {};
++template <>
++struct is_char_helper<char32_t> : public std::true_type {};
++template <typename T>
++struct is_char : public is_char_helper<std::remove_cv_t<T>>::type {};
++template <typename T>
++inline constexpr bool is_char_v = is_char<T>::value;
++
+ template <typename T>
+ T get_random_number() {
+ std::mt19937_64 gen(cpp_random_seed);
+
+ if constexpr (std::is_same_v<T, bool>) {
+ return g_random_boolean();
++ } else if constexpr (is_char_v<T>) {
++ return std::char_traits<T>::to_char_type(
++ get_random_number<typename std::char_traits<T>::int_type>());
+ } else if constexpr (std::is_integral_v<T>) {
+ T lowest_value = std::numeric_limits<T>::lowest();
+
+--
+GitLab