[前][次][番号順一覧][スレッド一覧]

ruby-changes:66401

From: Nobuyoshi <ko1@a...>
Date: Wed, 2 Jun 2021 13:50:50 +0900 (JST)
Subject: [ruby-changes:66401] 0f97aaa6cf (master): Suppress false warning by MSVC

https://git.ruby-lang.org/ruby.git/commit/?id=0f97aaa6cf

From 0f97aaa6cff486cce5e5d0cea796a6522df0e5e6 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 2 Jun 2021 13:41:54 +0900
Subject: Suppress false warning by MSVC

https://github.com/ruby/ruby/runs/2707566811#step:10:147
```
D:\a\ruby\ruby\src\mjit_worker.c(1212): warning C4090: 'function': different 'const' qualifiers
```
---
 mjit_worker.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/mjit_worker.c b/mjit_worker.c
index 6d9ce69..f2bfb51 100644
--- a/mjit_worker.c
+++ b/mjit_worker.c
@@ -753,6 +753,18 @@ set_compiling_iseqs(const rb_iseq_t *iseq) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L753
     return true;
 }
 
+static void
+free_compiling_iseqs(void)
+{
+    RBIMPL_WARNING_PUSH();
+#ifdef _MSC_VER
+    RBIMPL_WARNING_IGNORED(4090); /* suppress false warning by MSVC */
+#endif
+    free(compiling_iseqs);
+    RBIMPL_WARNING_POP();
+    compiling_iseqs = NULL;
+}
+
 bool
 rb_mjit_compiling_iseq_p(const rb_iseq_t *iseq)
 {
@@ -1008,8 +1020,7 @@ compile_compact_jit_code(char* c_file) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1020
         success &= mjit_compile(f, child_unit->iseq, funcname, child_unit->id);
 
         CRITICAL_SECTION_START(3, "before compiling_iseqs free");
-        free(compiling_iseqs);
-        compiling_iseqs = NULL;
+        free_compiling_iseqs();
         CRITICAL_SECTION_FINISH(3, "after compiling_iseqs free");
     }
 
@@ -1209,8 +1220,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1220
 
     // release blocking mjit_gc_start_hook
     CRITICAL_SECTION_START(3, "after mjit_compile to wakeup client for GC");
-    free(compiling_iseqs);
-    compiling_iseqs = NULL;
+    free_compiling_iseqs();
     in_jit = false;
     verbose(3, "Sending wakeup signal to client in a mjit-worker for GC");
     rb_native_cond_signal(&mjit_client_wakeup);
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]