[ruby/date] Suppress warnings by gcc-13 with -Og

https://github.com/ruby/date/commit/6dd7969a64
This commit is contained in:
Nobuyoshi Nakada 2025-06-05 23:12:38 +09:00 committed by git
parent edaa27ce45
commit 998e5791c5
2 changed files with 43 additions and 16 deletions

View File

@ -3878,7 +3878,6 @@ static VALUE
rt_complete_frags(VALUE klass, VALUE hash)
{
static VALUE tab = Qnil;
int g;
long e;
VALUE k, a, d;
@ -3975,9 +3974,13 @@ rt_complete_frags(VALUE klass, VALUE hash)
rb_gc_register_mark_object(tab);
}
{
long i, eno = 0, idx = 0;
k = Qnil;
{
long i, eno = 0;
VALUE t = Qnil;
e = 0;
for (i = 0; i < RARRAY_LEN(tab); i++) {
VALUE x, a;
@ -3992,23 +3995,20 @@ rt_complete_frags(VALUE klass, VALUE hash)
n++;
if (n > eno) {
eno = n;
idx = i;
t = x;
}
}
}
if (eno == 0)
g = 0;
else {
g = 1;
k = RARRAY_AREF(RARRAY_AREF(tab, idx), 0);
a = RARRAY_AREF(RARRAY_AREF(tab, idx), 1);
e = eno;
if (eno > 0) {
k = RARRAY_AREF(t, 0);
a = RARRAY_AREF(t, 1);
}
e = eno;
}
d = Qnil;
if (g && !NIL_P(k) && (RARRAY_LEN(a) - e)) {
if (!NIL_P(k) && (RARRAY_LEN(a) > e)) {
if (k == sym("ordinal")) {
if (NIL_P(ref_hash("year"))) {
if (NIL_P(d))
@ -4095,7 +4095,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
}
}
if (g && k == sym("time")) {
if (k == sym("time")) {
if (f_le_p(klass, cDateTime)) {
if (NIL_P(d))
d = date_s_today(0, (VALUE *)0, cDate);

View File

@ -1,4 +1,4 @@
/* ANSI-C code produced by gperf version 3.1 */
/* ANSI-C code produced by gperf version 3.3 */
/* Command-line: gperf --ignore-case -L ANSI-C -C -c -P -p -j1 -i 1 -g -o -t -N zonetab zonetab.list */
/* Computed positions: -k'1-4,9' */
@ -51,7 +51,7 @@ struct zone;
#ifndef GPERF_DOWNCASE
#define GPERF_DOWNCASE 1
static unsigned char gperf_downcase[256] =
static const unsigned char gperf_downcase[256] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
@ -144,6 +144,11 @@ hash (register const char *str, register size_t len)
{
default:
hval += asso_values[(unsigned char)str[8]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 8:
case 7:
@ -151,12 +156,27 @@ hash (register const char *str, register size_t len)
case 5:
case 4:
hval += asso_values[(unsigned char)str[3]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 3:
hval += asso_values[(unsigned char)str[2]];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 2:
hval += asso_values[(unsigned char)str[1]+6];
#if (defined __cplusplus && (__cplusplus >= 201703L || (__cplusplus >= 201103L && defined __clang__ && __clang_major__ + (__clang_minor__ >= 9) > 3))) || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 202000L && ((defined __GNUC__ && __GNUC__ >= 10) || (defined __clang__ && __clang_major__ >= 9)))
[[fallthrough]];
#elif (defined __GNUC__ && __GNUC__ >= 7) || (defined __clang__ && __clang_major__ >= 10)
__attribute__ ((__fallthrough__));
#endif
/*FALLTHROUGH*/
case 1:
hval += asso_values[(unsigned char)str[0]+52];
@ -807,6 +827,10 @@ static const struct stringpool_t stringpool_contents =
const struct zone *
zonetab (register const char *str, register size_t len)
{
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
static const struct zone wordlist[] =
{
{-1}, {-1},
@ -1541,6 +1565,9 @@ zonetab (register const char *str, register size_t len)
#line 141 "zonetab.list"
{(int)(size_t)&((struct stringpool_t *)0)->stringpool_str619, -10800}
};
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 6) > 4) || (defined __clang__ && __clang_major__ >= 3)
#pragma GCC diagnostic pop
#endif
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
@ -1558,7 +1585,7 @@ zonetab (register const char *str, register size_t len)
}
}
}
return 0;
return (struct zone *) 0;
}
#line 330 "zonetab.list"