From 1f255adda93bd7958afc7405026326f630ba4748 Mon Sep 17 00:00:00 2001 From: xtkoba <69125751+xtkoba@users.noreply.github.com> Date: Fri, 30 Apr 2021 10:09:32 +0900 Subject: [PATCH] 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 c3d600114f..d963038d94 100644 --- a/strftime.c +++ b/strftime.c @@ -389,7 +389,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len, 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, 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]);