postgresql/src/include/common
Peter Eisentraut 8354b9d6b6 Use fallthrough attribute instead of comment
Instead of using comments to mark fallthrough switch cases, use the
fallthrough attribute.  This will (in the future, not here) allow
supporting other compilers besides gcc.  The commenting convention is
only supported by gcc, the attribute is supported by clang, and in the
fullness of time the C23 standard attribute would allow supporting
other compilers as well.

Right now, we package the attribute into a macro called
pg_fallthrough.  This commit defines that macro and replaces the
existing comments with that macro invocation.

We also raise the level of the gcc -Wimplicit-fallthrough= option from
3 to 5 to enforce the use of the attribute.

Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org
2026-02-19 08:51:12 +01:00
..
archive.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
base64.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
blkreftable.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
checksum_helper.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
compression.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
config_info.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
connect.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
controldata_utils.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
cryptohash.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
fe_memutils.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
file_perm.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
file_utils.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
hashfn.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
hashfn_unstable.h Use fallthrough attribute instead of comment 2026-02-19 08:51:12 +01:00
hmac.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
int.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
int128.h Fix typos and inconsistencies in code and comments 2026-01-05 09:19:15 +09:00
ip.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
jsonapi.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
keywords.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
kwlookup.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
link-canary.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
logging.h Revert "Replace pg_restrict by standard restrict" 2026-01-14 15:12:25 +01:00
md5.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
oauth-common.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
openssl.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
parse_manifest.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
percentrepl.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pg_lzcompress.h Apply PGDLLIMPORT markings broadly. 2022-04-08 08:16:38 -04:00
pg_prng.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
relpath.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
restricted_token.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
saslprep.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
scram-common.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
sha1.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
sha2.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
shortest_dec.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
string.h Revert "Replace pg_restrict by standard restrict" 2026-01-14 15:12:25 +01:00
unicode_case.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_case_table.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_category.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_category_table.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_east_asian_fw_table.h Update Unicode data to Unicode 16.0.0 2025-04-03 12:00:09 +02:00
unicode_nonspacing_table.h Update Unicode data to Unicode 16.0.0 2025-04-03 12:00:09 +02:00
unicode_norm.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_norm_hashfunc.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_norm_table.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
unicode_normprops_table.h Update Unicode data to Unicode 16.0.0 2025-04-03 12:00:09 +02:00
unicode_version.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
username.h Update copyright for 2026 2026-01-01 13:24:10 -05:00