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

ruby-changes:73405

From: Takashi <ko1@a...>
Date: Sun, 4 Sep 2022 12:02:47 +0900 (JST)
Subject: [ruby-changes:73405] cfa40e225a (master): Prefer stdbool for MJIT options

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

From cfa40e225adb30b777ef50d9d8dc15a51e3d2797 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sat, 3 Sep 2022 20:01:50 -0700
Subject: Prefer stdbool for MJIT options

same motivation as d6f21b308bcff03e82f8b3dbf11a852ce111b3b3
---
 mjit.c |  8 ++++----
 mjit.h | 10 +++++-----
 ruby.c |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/mjit.c b/mjit.c
index a873b3d9f8..662ef99b32 100644
--- a/mjit.c
+++ b/mjit.c
@@ -1768,19 +1768,19 @@ mjit_setup_options(const char *s, struct mjit_options *mjit_opt) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1768
         return;
     }
     else if (opt_match_noarg(s, l, "warnings")) {
-        mjit_opt->warnings = 1;
+        mjit_opt->warnings = true;
     }
     else if (opt_match(s, l, "debug")) {
         if (*s)
             mjit_opt->debug_flags = strdup(s + 1);
         else
-            mjit_opt->debug = 1;
+            mjit_opt->debug = true;
     }
     else if (opt_match_noarg(s, l, "wait")) {
-        mjit_opt->wait = 1;
+        mjit_opt->wait = true;
     }
     else if (opt_match_noarg(s, l, "save-temps")) {
-        mjit_opt->save_temps = 1;
+        mjit_opt->save_temps = true;
     }
     else if (opt_match(s, l, "verbose")) {
         mjit_opt->verbose = *s ? atoi(s + 1) : 1;
diff --git a/mjit.h b/mjit.h
index 045612d7be..66db417daf 100644
--- a/mjit.h
+++ b/mjit.h
@@ -37,20 +37,20 @@ enum rb_mjit_iseq_func { https://github.com/ruby/ruby/blob/trunk/mjit.h#L37
 struct mjit_options {
     // Converted from "jit" feature flag to tell the enablement
     // information to ruby_show_version().
-    char on;
+    bool on;
     // Save temporary files after MRI finish.  The temporary files
     // include the pre-compiled header, C code file generated for ISEQ,
     // and the corresponding object file.
-    char save_temps;
+    bool save_temps;
     // Print MJIT warnings to stderr.
-    char warnings;
+    bool warnings;
     // Disable compiler optimization and add debug symbols. It can be
     // very slow.
-    char debug;
+    bool debug;
     // Add arbitrary cflags.
     char* debug_flags;
     // If not 0, all ISeqs are synchronously compiled. For testing.
-    unsigned int wait;
+    bool wait;
     // Number of calls to trigger JIT compilation. For testing.
     unsigned int min_calls;
     // Force printing info about MJIT work of level VERBOSE or
diff --git a/ruby.c b/ruby.c
index 26d263a1b1..4f33267d73 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1850,7 +1850,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) https://github.com/ruby/ruby/blob/trunk/ruby.c#L1850
 
 #if USE_MJIT
     if (FEATURE_SET_P(opt->features, mjit)) {
-        opt->mjit.on = TRUE; /* set mjit.on for ruby_show_version() API and check to call mjit_init() */
+        opt->mjit.on = true; // set mjit.on for ruby_show_version() API and check to call mjit_init()
     }
 #endif
 #if USE_YJIT
-- 
cgit v1.2.1


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

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