]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUILD: compiler: add a new type modifier __maybe_unused
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Nov 2017 20:22:17 +0000 (21:22 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Nov 2017 20:27:27 +0000 (21:27 +0100)
commitdbd25fc75ad2e409c7347289d245e10521cc240a
tree16e06bffe468a1ba5540c5afdd399948bb1dccf5
parent0cb98b2451a6005c47ff1b49737ffbd9bb0cf179
BUILD: compiler: add a new type modifier __maybe_unused

While gcc only emits warnings about unused static functions, Clang also
emits such a warning when the functions are inlined. This is a bit
annoying at certain places where functions are provided to manipulate
multiple data types and are not yet used. Let's have a type modifier
"__maybe_unused" which sets the "unused" attribute like the Linux kernel
does. It's elegant as it allows the code author to indicate that it knows
that this element might be unused. It works on variables as well, which
is convenient to remove ifdefs around local variables in certain functions,
but doesn't work on labels.
include/common/compiler.h