mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Add -Wimplicit-fallthrough to CFLAGS and CXXFLAGS
Use it at level 4, a bit more restrictive than the default level, and tweak our commanding comments to FALLTHROUGH. (However, leave zic.c alone, since it's external code; to avoid the warnings that would appear there, change CFLAGS for that file in the Makefile.) Author: Julien Rouhaud <rjuju123@gmail.com> Author: Álvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20200412081825.qyo5vwwco3fv4gdo@nol Discussion: https://postgr.es/m/flat/E1fDenm-0000C8-IJ@gemulon.postgresql.org
This commit is contained in:
@ -303,7 +303,7 @@ pg_wc_isdigit(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswdigit((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isdigit((unsigned char) c));
|
||||
@ -312,7 +312,7 @@ pg_wc_isdigit(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswdigit_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -339,7 +339,7 @@ pg_wc_isalpha(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalpha((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isalpha((unsigned char) c));
|
||||
@ -348,7 +348,7 @@ pg_wc_isalpha(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalpha_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -375,7 +375,7 @@ pg_wc_isalnum(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalnum((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isalnum((unsigned char) c));
|
||||
@ -384,7 +384,7 @@ pg_wc_isalnum(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalnum_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -411,7 +411,7 @@ pg_wc_isupper(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswupper((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isupper((unsigned char) c));
|
||||
@ -420,7 +420,7 @@ pg_wc_isupper(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswupper_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -447,7 +447,7 @@ pg_wc_islower(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswlower((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
islower((unsigned char) c));
|
||||
@ -456,7 +456,7 @@ pg_wc_islower(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswlower_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -483,7 +483,7 @@ pg_wc_isgraph(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswgraph((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isgraph((unsigned char) c));
|
||||
@ -492,7 +492,7 @@ pg_wc_isgraph(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswgraph_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -519,7 +519,7 @@ pg_wc_isprint(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswprint((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isprint((unsigned char) c));
|
||||
@ -528,7 +528,7 @@ pg_wc_isprint(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswprint_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -555,7 +555,7 @@ pg_wc_ispunct(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswpunct((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
ispunct((unsigned char) c));
|
||||
@ -564,7 +564,7 @@ pg_wc_ispunct(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswpunct_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -591,7 +591,7 @@ pg_wc_isspace(pg_wchar c)
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswspace((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isspace((unsigned char) c));
|
||||
@ -600,7 +600,7 @@ pg_wc_isspace(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswspace_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
@ -631,7 +631,7 @@ pg_wc_toupper(pg_wchar c)
|
||||
return pg_ascii_toupper((unsigned char) c);
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towupper((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
/* force C behavior for ASCII characters, per comments above */
|
||||
if (c <= (pg_wchar) 127)
|
||||
@ -644,7 +644,7 @@ pg_wc_toupper(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towupper_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (c <= (pg_wchar) UCHAR_MAX)
|
||||
@ -675,7 +675,7 @@ pg_wc_tolower(pg_wchar c)
|
||||
return pg_ascii_tolower((unsigned char) c);
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towlower((wint_t) c);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
/* force C behavior for ASCII characters, per comments above */
|
||||
if (c <= (pg_wchar) 127)
|
||||
@ -688,7 +688,7 @@ pg_wc_tolower(pg_wchar c)
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towlower_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case PG_REGEX_LOCALE_1BYTE_L:
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (c <= (pg_wchar) UCHAR_MAX)
|
||||
|
Reference in New Issue
Block a user