Skip to content

Commit 5af23e7

Browse files
committed
Bug#25750150: IMPLICIT FALLTHROUGH WARNINGS IN JSON_DOM.CC
GCC 7 warns about implicit fallthrough in a switch statement in json_dom.cc. The code in question is not intended to fall through. Fix: Move break statements so that they break out of the outer switch statement instead of breaking out of the inner switch statement only. Change-Id: I606757e820a3afff9f25dfd92aa4ef6ce75f816f
1 parent 0d8a877 commit 5af23e7

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

sql/json_dom.cc

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,9 +2984,9 @@ int Json_wrapper::compare(const Json_wrapper &other) const
29842984
return 1; /* purecov: inspected */
29852985
return -compare_json_decimal_int(b_dec, get_int());
29862986
}
2987-
default:
2988-
break;
2987+
default:;
29892988
}
2989+
break;
29902990
case enum_json_type::J_UINT:
29912991
// Unsigned integers can be compared to all other numbers.
29922992
switch (other_type)
@@ -3004,31 +3004,29 @@ int Json_wrapper::compare(const Json_wrapper &other) const
30043004
return 1; /* purecov: inspected */
30053005
return -compare_json_decimal_uint(b_dec, get_uint());
30063006
}
3007-
default:
3008-
break;
3007+
default:;
30093008
}
3009+
break;
30103010
case enum_json_type::J_DOUBLE:
30113011
// Doubles can be compared to all other numbers.
3012+
switch (other_type)
30123013
{
3013-
switch (other_type)
3014+
case enum_json_type::J_DOUBLE:
3015+
return compare_numbers(get_double(), other.get_double());
3016+
case enum_json_type::J_INT:
3017+
return compare_json_double_int(get_double(), other.get_int());
3018+
case enum_json_type::J_UINT:
3019+
return compare_json_double_uint(get_double(), other.get_uint());
3020+
case enum_json_type::J_DECIMAL:
30143021
{
3015-
case enum_json_type::J_DOUBLE:
3016-
return compare_numbers(get_double(), other.get_double());
3017-
case enum_json_type::J_INT:
3018-
return compare_json_double_int(get_double(), other.get_int());
3019-
case enum_json_type::J_UINT:
3020-
return compare_json_double_uint(get_double(), other.get_uint());
3021-
case enum_json_type::J_DECIMAL:
3022-
{
3023-
my_decimal other_dec;
3024-
if (other.get_decimal_data(&other_dec))
3025-
return 1; /* purecov: inspected */
3026-
return -compare_json_decimal_double(other_dec, get_double());
3027-
}
3028-
default:
3029-
break;
3022+
my_decimal other_dec;
3023+
if (other.get_decimal_data(&other_dec))
3024+
return 1; /* purecov: inspected */
3025+
return -compare_json_decimal_double(other_dec, get_double());
30303026
}
3027+
default:;
30313028
}
3029+
break;
30323030
case enum_json_type::J_DECIMAL:
30333031
// Decimals can be compared to all other numbers.
30343032
{
@@ -3054,9 +3052,9 @@ int Json_wrapper::compare(const Json_wrapper &other) const
30543052
return compare_json_decimal_uint(a_dec, other.get_uint());
30553053
case enum_json_type::J_DOUBLE:
30563054
return compare_json_decimal_double(a_dec, other.get_double());
3057-
default:
3058-
break;
3055+
default:;
30593056
}
3057+
break;
30603058
}
30613059
case enum_json_type::J_BOOLEAN:
30623060
// Booleans are only equal to other booleans. false is less than true.

0 commit comments

Comments
 (0)