]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-121040: Use __attribute__((fallthrough)) (#121044)
authorVictor Stinner <vstinner@python.org>
Thu, 27 Jun 2024 09:58:44 +0000 (11:58 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jun 2024 09:58:44 +0000 (09:58 +0000)
commit12af8ec864225248c3d2916cb142a5e7ee36cbe2
treed29a5c87668a1cd1e67ceee0b9074ce7f2c74392
parent4999e0bda091826fcdf303dd439364e1d303a5ce
gh-121040: Use __attribute__((fallthrough)) (#121044)

Fix warnings when using -Wimplicit-fallthrough compiler flag.

Annotate explicitly "fall through" switch cases with a new
_Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if
available. Replace "fall through" comments with _Py_FALLTHROUGH.

Add _Py__has_attribute() macro. No longer define __has_attribute()
macro if it's not defined. Move also _Py__has_builtin() at the top
of pyport.h.

Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
29 files changed:
Include/exports.h
Include/pyport.h
Modules/_csv.c
Modules/_ctypes/_ctypes.c
Modules/_ctypes/stgdict.c
Modules/_interpqueuesmodule.c
Modules/_ssl.c
Modules/_struct.c
Modules/_testcapi/exceptions.c
Modules/cjkcodecs/_codecs_iso2022.c
Modules/overlapped.c
Modules/socketmodule.c
Modules/zlibmodule.c
Objects/rangeobject.c
Objects/stringlib/codecs.h
Objects/unicodeobject.c
Python/assemble.c
Python/bytecodes.c
Python/compile.c
Python/crossinterp.c
Python/dtoa.c
Python/formatter_unicode.c
Python/generated_cases.c.h
Python/getargs.c
Python/importdl.c
Python/marshal.c
Python/modsupport.c
Python/pyhash.c
Python/pystrtod.c