Prefer stdbool for MJIT options

same motivation as d6f21b308bcff03e82f8b3dbf11a852ce111b3b3
This commit is contained in:
Takashi Kokubun 2022-09-03 20:01:50 -07:00
parent 13a59747c8
commit cfa40e225a
No known key found for this signature in database
GPG Key ID: 6FFC433B12EE23DD
3 changed files with 10 additions and 10 deletions

8
mjit.c
View File

@ -1768,19 +1768,19 @@ mjit_setup_options(const char *s, struct mjit_options *mjit_opt)
return; return;
} }
else if (opt_match_noarg(s, l, "warnings")) { else if (opt_match_noarg(s, l, "warnings")) {
mjit_opt->warnings = 1; mjit_opt->warnings = true;
} }
else if (opt_match(s, l, "debug")) { else if (opt_match(s, l, "debug")) {
if (*s) if (*s)
mjit_opt->debug_flags = strdup(s + 1); mjit_opt->debug_flags = strdup(s + 1);
else else
mjit_opt->debug = 1; mjit_opt->debug = true;
} }
else if (opt_match_noarg(s, l, "wait")) { 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")) { 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")) { else if (opt_match(s, l, "verbose")) {
mjit_opt->verbose = *s ? atoi(s + 1) : 1; mjit_opt->verbose = *s ? atoi(s + 1) : 1;

10
mjit.h
View File

@ -37,20 +37,20 @@ enum rb_mjit_iseq_func {
struct mjit_options { struct mjit_options {
// Converted from "jit" feature flag to tell the enablement // Converted from "jit" feature flag to tell the enablement
// information to ruby_show_version(). // information to ruby_show_version().
char on; bool on;
// Save temporary files after MRI finish. The temporary files // Save temporary files after MRI finish. The temporary files
// include the pre-compiled header, C code file generated for ISEQ, // include the pre-compiled header, C code file generated for ISEQ,
// and the corresponding object file. // and the corresponding object file.
char save_temps; bool save_temps;
// Print MJIT warnings to stderr. // Print MJIT warnings to stderr.
char warnings; bool warnings;
// Disable compiler optimization and add debug symbols. It can be // Disable compiler optimization and add debug symbols. It can be
// very slow. // very slow.
char debug; bool debug;
// Add arbitrary cflags. // Add arbitrary cflags.
char* debug_flags; char* debug_flags;
// If not 0, all ISeqs are synchronously compiled. For testing. // If not 0, all ISeqs are synchronously compiled. For testing.
unsigned int wait; bool wait;
// Number of calls to trigger JIT compilation. For testing. // Number of calls to trigger JIT compilation. For testing.
unsigned int min_calls; unsigned int min_calls;
// Force printing info about MJIT work of level VERBOSE or // Force printing info about MJIT work of level VERBOSE or

2
ruby.c
View File

@ -1850,7 +1850,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
#if USE_MJIT #if USE_MJIT
if (FEATURE_SET_P(opt->features, 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 #endif
#if USE_YJIT #if USE_YJIT