From c79308974120dc160bd933520b285caafea0ffa6 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 5 Sep 2021 15:29:07 +0200 Subject: [PATCH] graphene: fix public api when using gcc vectors --- .../patches/gcc-vectors-fix-pragmas.patch | 125 ++++++++++++++++++ srcpkgs/graphene/template | 2 +- 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/graphene/patches/gcc-vectors-fix-pragmas.patch diff --git a/srcpkgs/graphene/patches/gcc-vectors-fix-pragmas.patch b/srcpkgs/graphene/patches/gcc-vectors-fix-pragmas.patch new file mode 100644 index 00000000000..6d9b9287208 --- /dev/null +++ b/srcpkgs/graphene/patches/gcc-vectors-fix-pragmas.patch @@ -0,0 +1,125 @@ +From 2756f97c802d6c461cab2a865a98a09504410083 Mon Sep 17 00:00:00 2001 +From: q66 +Date: Sun, 5 Sep 2021 15:21:39 +0200 +Subject: [PATCH] Fix various broken macros when using GCC extension vectors + +Commit 8e5c25109898fa4894df810a546b26c387eaae93 introduced +some pragmas, however those unintentionally change the types +of the macros, as the diagnostic pop pragma becomes the last +statement and the type of the expression becomes void. + +Work around this by using a temporary and evaluating to that +before popping. +--- + include/graphene-simd4f.h | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/include/graphene-simd4f.h b/include/graphene-simd4f.h +index f95fe04..ea29ba3 100644 +--- a/include/graphene-simd4f.h ++++ b/include/graphene-simd4f.h +@@ -858,13 +858,14 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ +- (graphene_simd4f_t) { \ ++ const graphene_simd4f_t __val = (graphene_simd4f_t) { \ + (v)[0] != 0.f ? 1.f / (v)[0] : 0.f, \ + (v)[1] != 0.f ? 1.f / (v)[1] : 0.f, \ + (v)[2] != 0.f ? 1.f / (v)[2] : 0.f, \ + (v)[3] != 0.f ? 1.f / (v)[3] : 0.f, \ + }; \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_sqrt(v) \ +@@ -881,13 +882,14 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ +- (graphene_simd4f_t) { \ ++ const graphene_simd4f_t __val = (graphene_simd4f_t) { \ + (v)[0] != 0.f ? 1.f / sqrtf ((v)[0]) : 0.f, \ + (v)[1] != 0.f ? 1.f / sqrtf ((v)[1]) : 0.f, \ + (v)[2] != 0.f ? 1.f / sqrtf ((v)[2]) : 0.f, \ + (v)[3] != 0.f ? 1.f / sqrtf ((v)[3]) : 0.f, \ + }; \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_add(a,b) (__extension__ ({ (graphene_simd4f_t) ((a) + (b)); })) +@@ -1003,11 +1005,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ + const graphene_simd4i_t __res = (a) == (b); \ +- (bool) (__res[0] != 0 && \ ++ const bool __val = (bool) (__res[0] != 0 && \ + __res[1] != 0 && \ + __res[2] != 0 && \ + __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_cmp_neq(a,b) (!graphene_simd4f_cmp_eq (a,b)) +@@ -1017,11 +1020,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ + const graphene_simd4i_t __res = (a) < (b); \ +- (bool) (__res[0] != 0 && \ ++ const bool __val = (bool) (__res[0] != 0 && \ + __res[1] != 0 && \ + __res[2] != 0 && \ + __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_cmp_le(a,b) \ +@@ -1029,11 +1033,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ + const graphene_simd4i_t __res = (a) <= (b); \ +- (bool) (__res[0] != 0 && \ ++ const bool __val = (bool) (__res[0] != 0 && \ + __res[1] != 0 && \ + __res[2] != 0 && \ + __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_cmp_ge(a,b) \ +@@ -1041,11 +1046,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ + const graphene_simd4i_t __res = (a) >= (b); \ +- (bool) (__res[0] != 0 && \ ++ const bool __val = (bool) (__res[0] != 0 && \ + __res[1] != 0 && \ + __res[2] != 0 && \ + __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_cmp_gt(a,b) \ +@@ -1053,11 +1059,12 @@ typedef int graphene_simd4i_t __attribute__((vector_size (16))); + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ + const graphene_simd4i_t __res = (a) > (b); \ +- (bool) (__res[0] != 0 && \ ++ const bool __val = (bool) (__res[0] != 0 && \ + __res[1] != 0 && \ + __res[2] != 0 && \ + __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ ++ __val; \ + })) + + # define graphene_simd4f_neg(s) \ +-- +2.32.0 + diff --git a/srcpkgs/graphene/template b/srcpkgs/graphene/template index 40920cb1f5b..79b2ac2e945 100644 --- a/srcpkgs/graphene/template +++ b/srcpkgs/graphene/template @@ -1,7 +1,7 @@ # Template file for 'graphene' pkgname=graphene version=1.10.6 -revision=2 +revision=3 build_style=meson build_helper="gir" configure_args="-Dbenchmarks=false -Dinstalled_tests=false