]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUILD: compiler: define a __fallthrough statement for switch/case
authorWilly Tarreau <w@1wt.eu>
Sun, 13 Nov 2022 11:21:22 +0000 (12:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 Nov 2022 10:14:02 +0000 (11:14 +0100)
commit1f344c0f30078daf178b4b17dc642540de4ed6ca
tree8791f02e443dc7abffa1afcf5576734c67800ea2
parent2b080f713f61d19a91a1ef27ec0505c20739d508
BUILD: compiler: define a __fallthrough statement for switch/case

When the code is preprocessed first and compiled later, such as when
built under distcc, a lot of fallthrough warnings are emitted because
the preprocessor has already stripped the comments.

As an alternative, a "fallthrough" attribute was added with the same
compilers as those which started to emit those warnings. However it's
not portable to older compilers. Let's just define a __fallthrough
statement that corresponds to this attribute on supported compilers
and only switches to the classical empty do {} while (0) on other ones.

This way the code will support being cleaned up using __fallthrough.
include/haproxy/compiler.h