FreeBSD Bugzilla – Attachment 236621 Details for
Bug 266227
[exp-run] Request for exp-run with qsort_r API change
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for graphics/mesa-devel
0001-graphics-mesa-devel-Improve-qsort_r-detection.patch (text/plain), 3.07 KB, created by
Xin LI
on 2022-09-17 04:50:44 UTC
(
hide
)
Description:
Proposed patch for graphics/mesa-devel
Filename:
MIME Type:
Creator:
Xin LI
Created:
2022-09-17 04:50:44 UTC
Size:
3.07 KB
patch
obsolete
>From e0b0072a212eab184ec0b0c51f2d5852d3ebc755 Mon Sep 17 00:00:00 2001 >From: Xin LI <delphij@FreeBSD.org> >Date: Fri, 16 Sep 2022 21:48:05 -0700 >Subject: [PATCH] graphics/mesa-devel: Improve qsort_r detection. > >This change is upstreamed as https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18527 >but not yet merged. > >PR: 266227 >Approved by: (?) >--- > graphics/mesa-devel/files/patch-qsort_r | 78 +++++++++++++++++++++++++ > 1 file changed, 78 insertions(+) > create mode 100644 graphics/mesa-devel/files/patch-qsort_r > >diff --git a/graphics/mesa-devel/files/patch-qsort_r b/graphics/mesa-devel/files/patch-qsort_r >new file mode 100644 >index 000000000000..d58b3d4e6150 >--- /dev/null >+++ b/graphics/mesa-devel/files/patch-qsort_r >@@ -0,0 +1,78 @@ >+diff --git meson.build meson.build >+index 4c6c4ffe4ceeb8d770cf53b0cf9dbdba764acdcc..85ca36f565069c3d29dba40b8e574e68de4af7f8 100644 >+--- meson.build >++++ meson.build >+@@ -1437,7 +1437,6 @@ functions_to_detect = { >+ 'flock': '', >+ 'strtok_r': '', >+ 'getrandom': '', >+- 'qsort_r': '', >+ 'qsort_s': '', >+ } >+ >+@@ -1447,6 +1446,37 @@ foreach f, prefix: functions_to_detect >+ endif >+ endforeach >+ >++if cpp.links(''' >++ #define _GNU_SOURCE >++ #include <stdlib.h> >++ >++ static int dcomp(const void *l, const void *r, void *t) { return 0; } >++ >++ int main(int ac, char **av) { >++ int arr[] = { 1 }; >++ void *t = NULL; >++ qsort_r((void*)&arr[0], 1, 1, dcomp, t); >++ return (0); >++ }''', >++ args : pre_args, >++ name : 'GNU qsort_r') >++ pre_args += '-DHAVE_GNU_QSORT_R' >++elif cpp.links(''' >++ #include <stdlib.h> >++ >++ static int dcomp(void *t, const void *l, const void *r) { return 0; } >++ >++ int main(int ac, char **av) { >++ int arr[] = { 1 }; >++ void *t = NULL; >++ qsort_r((void*)&arr[0], 1, 1, t, dcomp); >++ return (0); >++ }''', >++ args : pre_args, >++ name : 'BSD qsort_r') >++ pre_args += '-DHAVE_BSD_QSORT_R' >++endif >++ >+ if cc.has_header_symbol('time.h', 'struct timespec') >+ pre_args += '-DHAVE_STRUCT_TIMESPEC' >+ endif >+diff --git src/util/u_qsort.h src/util/u_qsort.h >+index 34fff94dba4106f09f3f514cf0dea54d2295eda5..454d3839863d10b76fad624f769caa10ead0b4e6 100644 >+--- src/util/u_qsort.h >++++ src/util/u_qsort.h >+@@ -56,8 +56,10 @@ util_qsort_r(void *base, size_t nmemb, size_t size, >+ int (*compar)(const void *, const void *, void *), >+ void *arg) >+ { >+-#if HAVE_QSORT_R >+-# if DETECT_OS_APPLE || DETECT_OS_BSD >++#if HAVE_GNU_QSORT_R >++ /* GNU extension added in glibc 2.8 */ >++ qsort_r(base, nmemb, size, compar, arg); >++#elif HAVE_BSD_QSORT_R >+ /* BSD/macOS qsort_r takes "arg" before the comparison function and it >+ * pass the "arg" before the elements. >+ */ >+@@ -66,10 +68,6 @@ util_qsort_r(void *base, size_t nmemb, size_t size, >+ arg >+ }; >+ qsort_r(base, nmemb, size, &data, util_qsort_adapter); >+-# else >+- /* GNU extension added in glibc 2.8 */ >+- qsort_r(base, nmemb, size, compar, arg); >+-# endif >+ #elif HAVE_QSORT_S >+ # ifdef _WIN32 >+ /* MSVC/MinGW qsort_s takes "arg" after the comparison function and it >-- >2.37.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 266227
:
236360
|
236386
|
236388
|
236389
|
236429
|
236470
|
236483
|
236507
|
236621
|
236638
|
236643
|
236644
|
236652
|
236678
|
236744
|
236760