diff --git a/mingw-w64-ruby-head/0010-Windows-Use-ATOMIC_PTR-functions-to-avoid-compiler-w.patch b/mingw-w64-ruby-head/0010-Windows-Use-ATOMIC_PTR-functions-to-avoid-compiler-w.patch new file mode 100644 index 0000000..4cafc99 --- /dev/null +++ b/mingw-w64-ruby-head/0010-Windows-Use-ATOMIC_PTR-functions-to-avoid-compiler-w.patch @@ -0,0 +1,54 @@ +From ffb58ea8b401e85474972cdba5be036c12b1fe2f Mon Sep 17 00:00:00 2001 +From: Lars Kanis +Date: Mon, 20 May 2024 14:54:44 +0200 +Subject: [PATCH] Windows: Use ATOMIC_PTR functions to avoid compiler warnings + due to incompatible types + +HCRYPTPROV can be casted to pointer without warning but not to size_t. +Avoids the following warning/error: + +../snapshot-master/random.c: In function 'fill_random_bytes_crypt': +../snapshot-master/include/ruby/atomic.h:246:28: warning: passing argument 1 of 'rbimpl_atomic_size_cas' from incompatible pointer type [-Wincompatible-pointer-types] + 246 | rbimpl_atomic_size_cas(&(var), (oldval), (newval)) + | ^~~~~~ + | | + | HCRYPTPROV * {aka long unsigned int *} +../snapshot-master/ruby_atomic.h:16:46: note: in expansion of macro 'RUBY_ATOMIC_SIZE_CAS' + 16 | #define ATOMIC_SIZE_CAS(var, oldval, newval) RUBY_ATOMIC_SIZE_CAS(var, oldval, newval) + | ^~~~~~~~~~~~~~~~~~~~ +../snapshot-master/random.c:594:32: note: in expansion of macro 'ATOMIC_SIZE_CAS' + 594 | old_prov = (HCRYPTPROV)ATOMIC_SIZE_CAS(perm_prov, 0, prov); +compiling ../snapshot-master/range.c + | ^~~~~~~~~~~~~~~ +../snapshot-master/include/ruby/atomic.h:853:41: note: expected 'volatile size_t *' {aka 'volatile unsigned int *'} but argument is of type 'HCRYPTPROV *' {aka 'long unsigned int *'} + 853 | rbimpl_atomic_size_cas(volatile size_t *ptr, size_t oldval, size_t newval) + | ~~~~~~~~~~~~~~~~~^~~ +--- + random.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/random.c b/random.c +index ea76ea656f..1986cf5f20 100644 +--- a/random.c ++++ b/random.c +@@ -576,7 +576,7 @@ static void + release_crypt(void *p) + { + HCRYPTPROV *ptr = p; +- HCRYPTPROV prov = (HCRYPTPROV)ATOMIC_SIZE_EXCHANGE(*ptr, INVALID_HCRYPTPROV); ++ HCRYPTPROV prov = (HCRYPTPROV)ATOMIC_PTR_EXCHANGE(*((char *)ptr), (char *)INVALID_HCRYPTPROV); + if (prov && prov != INVALID_HCRYPTPROV) { + CryptReleaseContext(prov, 0); + } +@@ -591,7 +591,7 @@ fill_random_bytes_crypt(void *seed, size_t size) + if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { + prov = INVALID_HCRYPTPROV; + } +- old_prov = (HCRYPTPROV)ATOMIC_SIZE_CAS(perm_prov, 0, prov); ++ old_prov = (HCRYPTPROV)ATOMIC_PTR_CAS(*((char *)&perm_prov), 0, (char *)prov); + if (LIKELY(!old_prov)) { /* no other threads acquired */ + if (prov != INVALID_HCRYPTPROV) { + #undef RUBY_UNTYPED_DATA_WARNING +-- +2.26.0.windows.1 + diff --git a/mingw-w64-ruby-head/PKGBUILD b/mingw-w64-ruby-head/PKGBUILD index 246244e..c7ab39d 100644 --- a/mingw-w64-ruby-head/PKGBUILD +++ b/mingw-w64-ruby-head/PKGBUILD @@ -1,7 +1,7 @@ _realname=ruby pkgbase=mingw-w64-ruby-head pkgname="${MINGW_PACKAGE_PREFIX}-ruby-head" -pkgver=r20221003 +pkgver=r20240520 pkgver() { echo r`date +%Y%m%d` } @@ -23,6 +23,7 @@ source=("https://cache.ruby-lang.org/pub/ruby/snapshot/snapshot-master.tar.xz" 0001-Add-C-ext-win32-dll_directory-as-an-alternative-to-f.patch 0002-Don-t-add-an-exe-file-manifest.patch 0009-Win32-Return-registry-strings-as-UTF-8.patch + 0010-Windows-Use-ATOMIC_PTR-functions-to-avoid-compiler-w.patch ruby.ico rubyw.ico) noextract=("snapshot-master.tar.xz") @@ -34,6 +35,7 @@ sha256sums=('SKIP' 'a50c81ab8c178689485257f8eaa70bd8184b878a798780084668f838912e2832' 'da079dbfdc3d4e1b976ed15d58244ed6e0df201ec829bead578fb4a7177b9cab' 'd221e357861ff3f46f29de978cc00a8f12ffdd865a5d8c1783f3e31e34675808' + '124f221ceb75d40e9f429603bf2383d8e60ad5fee9e2a9849e82bc9b89a41571' '6c80ba2ca49840e387a08b7fedc6e7acd298ac2ec853155209efb2af20397b22' 'c30fb04ac0e88ba634daaa811a81ea5a75027646617b895acd14df9518a4a55a') @@ -44,6 +46,7 @@ prepare() { patch -p1 -i ${srcdir}/0001-Add-C-ext-win32-dll_directory-as-an-alternative-to-f.patch patch -p1 -i ${srcdir}/0002-Don-t-add-an-exe-file-manifest.patch patch -p1 -i ${srcdir}/0009-Win32-Return-registry-strings-as-UTF-8.patch + patch -p1 -i ${srcdir}/0010-Windows-Use-ATOMIC_PTR-functions-to-avoid-compiler-w.patch autoreconf -fi }