diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb index 8a1467df09e402..3ab534f833edfd 100644 --- a/ext/date/extconf.rb +++ b/ext/date/extconf.rb @@ -3,6 +3,9 @@ config_string("strict_warnflags") {|w| $warnflags += " #{w}"} +unless try_compile("", "", werror: true) + append_cflags("-Wno-default-const-init-field-unsafe") +end append_cflags("-Wno-compound-token-split-by-macro") if RUBY_VERSION < "2.7." have_func("rb_category_warn") with_werror("", {:werror => true}) do |opt, | diff --git a/hash.c b/hash.c index 3ca035595d8231..172ed3bd49a502 100644 --- a/hash.c +++ b/hash.c @@ -654,7 +654,7 @@ ar_hint_first_match(ar_hint_t needle, VALUE haystack) { // Common SWAR technique. // First XOR all bytes so that matching ones are set to 0x00. - VALUE search_mask = AR_HINT_BASE_MASK * needle; + VALUE search_mask = (VALUE)AR_HINT_BASE_MASK * needle; VALUE matches = haystack ^ search_mask; // Then turns 0x00 into 0x80, and any other bytes into 0x00. diff --git a/parse.y b/parse.y index c726402e0fbd3c..7a566681964070 100644 --- a/parse.y +++ b/parse.y @@ -6817,7 +6817,7 @@ rb_parser_str_escape(struct parser_params *p, rb_parser_string_t *str) if (pend < ptr + n) n = (int)(pend - ptr); while (n--) { - c = *ptr & 0xf0 >> 4; + c = ((unsigned char)*ptr >> 4) & 0x0f; charbuf[2] = (c < 10) ? '0' + c : 'A' + c - 10; c = *ptr & 0x0f; charbuf[3] = (c < 10) ? '0' + c : 'A' + c - 10;