diff options
| author | Ian Rogers <irogers@google.com> | 2026-10-14 15:58:15 -0700 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-10-14 18:07:21 -0700 |
| commit | b1d7c3483c02d22f7b3070ea7299dd366d5b69d0 (patch) | |
| tree | 20980cec13676e82fbed66305a8e3a4dec68fe73 /scripts/basic/split-include.c | |
| parent | 2f70a9b7e9c74b92a85a2584090f0f5c4cbaa4be (diff) | |
| download | linux-next-b1d7c3483c02d22f7b3070ea7299dd366d5b69d0.tar.gz linux-next-b1d7c3483c02d22f7b3070ea7299dd366d5b69d0.zip | |
Compiler Attributes: Add __require_explicit_initialization macro
Clang supports the 'require_explicit_initialization' attribute on struct
fields to indicate that a field must be initialized explicitly by the
user when the object is constructed. When an aggregate initializer or
uninitialized variable omits an annotated field, Clang emits a
-Wuninitialized-explicit-init warning (enabled by default).
Add the __require_explicit_initialization macro to
include/linux/compiler_attributes.h (which is included by
include/linux/compiler_types.h and include/linux/compiler.h) so kernel
structs with error-prone initialization (such as mandatory callbacks or
cleanup handlers) can enforce explicit initialization at compile time,
as discussed at the Linux Plumbers Conference.
Also teach Sphinx (Documentation/conf.py), kernel-doc
(tools/lib/python/kdoc/xforms_lists.py), and checkpatch.pl about the new
attribute macro.
Link: https://lpc.events/event/20/contributions/2392/
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20261014225818.3457479-1-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
