git: b4b8c98857e4 - main - lang/ruby{27,30,31,32}: Improve qsort_r() detection.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 Sep 2022 06:31:59 UTC
The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/ports/commit/?id=b4b8c98857e409dd294fd58680cd05ae71893261 commit b4b8c98857e409dd294fd58680cd05ae71893261 Author: Xin LI <delphij@FreeBSD.org> AuthorDate: 2022-09-10 06:31:50 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2022-09-10 06:31:51 +0000 lang/ruby{27,30,31,32}: Improve qsort_r() detection. This change merges the following upstream pull request into the Ruby interpreter: https://github.com/ruby/ruby/pull/6332 Adding this patch is no-op right now because we are not using POSIX (GNU) qsort_r(3) interface yet. It will fix build when the change is applied. Reviewed by: bapt (portmgr@), sunpoet (ruby@) PR: ports/266227 MFH: 2022Q3 Differential Revision: https://reviews.freebsd.org/D36492 --- lang/ruby27/files/patch-util.c | 29 +++++++++++++++++++++++++++++ lang/ruby30/files/patch-util.c | 29 +++++++++++++++++++++++++++++ lang/ruby31/files/patch-util.c | 29 +++++++++++++++++++++++++++++ lang/ruby32/files/patch-util.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) diff --git a/lang/ruby27/files/patch-util.c b/lang/ruby27/files/patch-util.c new file mode 100644 index 000000000000..34686785879f --- /dev/null +++ b/lang/ruby27/files/patch-util.c @@ -0,0 +1,29 @@ +--- util.c.orig 2022-04-12 11:25:48 UTC ++++ util.c +@@ -210,6 +210,7 @@ typedef int (cmpfunc_t)(const void*, const void*, void + + typedef int (cmpfunc_t)(const void*, const void*, void*); + ++#if !defined HAVE_GNU_QSORT_R + #if defined HAVE_QSORT_S && defined RUBY_MSVCRT_VERSION + /* In contrast to its name, Visual Studio qsort_s is incompatible with + * C11 in the order of the comparison function's arguments, and same +@@ -255,7 +256,7 @@ ruby_qsort(void* base, const size_t nel, const size_t + qsort_s(base, nel, size, cmp, d); + } + # define HAVE_GNU_QSORT_R 1 +-#elif !defined HAVE_GNU_QSORT_R ++#else + /* mm.c */ + + #define mmtype long +@@ -521,7 +522,8 @@ ruby_qsort(void* base, const size_t nel, const size_t + else goto nxt; /* need not to sort both sides */ + } + } +-#endif /* HAVE_GNU_QSORT_R */ ++#endif ++#endif /* !HAVE_GNU_QSORT_R */ + + char * + ruby_strdup(const char *str) diff --git a/lang/ruby30/files/patch-util.c b/lang/ruby30/files/patch-util.c new file mode 100644 index 000000000000..f454ef14eb0d --- /dev/null +++ b/lang/ruby30/files/patch-util.c @@ -0,0 +1,29 @@ +--- util.c.orig 2022-04-12 11:48:55 UTC ++++ util.c +@@ -214,6 +214,7 @@ typedef int (cmpfunc_t)(const void*, const void*, void + + typedef int (cmpfunc_t)(const void*, const void*, void*); + ++#if !defined HAVE_GNU_QSORT_R + #if defined HAVE_QSORT_S && defined RUBY_MSVCRT_VERSION + /* In contrast to its name, Visual Studio qsort_s is incompatible with + * C11 in the order of the comparison function's arguments, and same +@@ -259,7 +260,7 @@ ruby_qsort(void* base, const size_t nel, const size_t + qsort_s(base, nel, size, cmp, d); + } + # define HAVE_GNU_QSORT_R 1 +-#elif !defined HAVE_GNU_QSORT_R ++#else + /* mm.c */ + + #define mmtype long +@@ -525,7 +526,8 @@ ruby_qsort(void* base, const size_t nel, const size_t + else goto nxt; /* need not to sort both sides */ + } + } +-#endif /* HAVE_GNU_QSORT_R */ ++#endif ++#endif /* !HAVE_GNU_QSORT_R */ + + char * + ruby_strdup(const char *str) diff --git a/lang/ruby31/files/patch-util.c b/lang/ruby31/files/patch-util.c new file mode 100644 index 000000000000..65701973aaee --- /dev/null +++ b/lang/ruby31/files/patch-util.c @@ -0,0 +1,29 @@ +--- util.c.orig 2022-04-12 11:11:15 UTC ++++ util.c +@@ -218,6 +218,7 @@ typedef int (cmpfunc_t)(const void*, const void*, void + + typedef int (cmpfunc_t)(const void*, const void*, void*); + ++#if !defined HAVE_GNU_QSORT_R + #if defined HAVE_QSORT_S && defined RUBY_MSVCRT_VERSION + /* In contrast to its name, Visual Studio qsort_s is incompatible with + * C11 in the order of the comparison function's arguments, and same +@@ -263,7 +264,7 @@ ruby_qsort(void* base, const size_t nel, const size_t + qsort_s(base, nel, size, cmp, d); + } + # define HAVE_GNU_QSORT_R 1 +-#elif !defined HAVE_GNU_QSORT_R ++#else + /* mm.c */ + + #define mmtype long +@@ -530,7 +531,8 @@ ruby_qsort(void* base, const size_t nel, const size_t + else goto nxt; /* need not to sort both sides */ + } + } +-#endif /* HAVE_GNU_QSORT_R */ ++#endif ++#endif /* !HAVE_GNU_QSORT_R */ + + char * + ruby_strdup(const char *str) diff --git a/lang/ruby32/files/patch-util.c b/lang/ruby32/files/patch-util.c new file mode 100644 index 000000000000..f454ef14eb0d --- /dev/null +++ b/lang/ruby32/files/patch-util.c @@ -0,0 +1,29 @@ +--- util.c.orig 2022-04-12 11:48:55 UTC ++++ util.c +@@ -214,6 +214,7 @@ typedef int (cmpfunc_t)(const void*, const void*, void + + typedef int (cmpfunc_t)(const void*, const void*, void*); + ++#if !defined HAVE_GNU_QSORT_R + #if defined HAVE_QSORT_S && defined RUBY_MSVCRT_VERSION + /* In contrast to its name, Visual Studio qsort_s is incompatible with + * C11 in the order of the comparison function's arguments, and same +@@ -259,7 +260,7 @@ ruby_qsort(void* base, const size_t nel, const size_t + qsort_s(base, nel, size, cmp, d); + } + # define HAVE_GNU_QSORT_R 1 +-#elif !defined HAVE_GNU_QSORT_R ++#else + /* mm.c */ + + #define mmtype long +@@ -525,7 +526,8 @@ ruby_qsort(void* base, const size_t nel, const size_t + else goto nxt; /* need not to sort both sides */ + } + } +-#endif /* HAVE_GNU_QSORT_R */ ++#endif ++#endif /* !HAVE_GNU_QSORT_R */ + + char * + ruby_strdup(const char *str)