ruby-changes:66023
From: xtkoba <ko1@a...>
Date: Fri, 30 Apr 2021 20:56:30 +0900 (JST)
Subject: [ruby-changes:66023] 1f255adda9 (master): Silence GCC 11 warnings
https://git.ruby-lang.org/ruby.git/commit/?id=1f255adda9 From 1f255adda93bd7958afc7405026326f630ba4748 Mon Sep 17 00:00:00 2001 From: xtkoba <69125751+xtkoba@u...> Date: Fri, 30 Apr 2021 10:09:32 +0900 Subject: Silence GCC 11 warnings ``` ../strftime.c: In function 'rb_strftime_with_timespec': ../strftime.c:392:39: warning: comparison is always false due to limited range of data type [-Wtype-limits] 392 | if (vtm->wday < 0 || vtm->wday > 6) | ^ ../strftime.c:403:39: warning: comparison is always false due to limited range of data type [-Wtype-limits] 403 | if (vtm->wday < 0 || vtm->wday > 6) | ^ ``` --- strftime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strftime.c b/strftime.c index c3d6001..d963038 100644 --- a/strftime.c +++ b/strftime.c @@ -389,7 +389,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, https://github.com/ruby/ruby/blob/trunk/strftime.c#L389 flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE)); flags |= BIT_OF(UPPER); } - if (vtm->wday < 0 || vtm->wday > 6) + if (vtm->wday > 6) i = 1, tp = "?"; else i = 3, tp = days_l[vtm->wday]; @@ -400,7 +400,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, https://github.com/ruby/ruby/blob/trunk/strftime.c#L400 flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE)); flags |= BIT_OF(UPPER); } - if (vtm->wday < 0 || vtm->wday > 6) + if (vtm->wday > 6) i = 1, tp = "?"; else i = strlen(tp = days_l[vtm->wday]); -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/