[PATCH 01/11] Compiler Attributes: Add __require_explicit_initialization macro
Nick Desaulniers
ndesaulniers at google.com
Wed Oct 14 09:44:29 PDT 2026
On Wed, Oct 14, 2026 at 9:37 AM Kees Cook <kees at kernel.org> wrote:
>
> On Wed, Oct 14, 2026 at 01:28:55PM +0200, Miguel Ojeda wrote:
> > On Wed, Oct 14, 2026 at 12:40 AM Ian Rogers <irogers at google.com> wrote:
> > >
> > > +/*
> > > + * Optional: not supported by gcc
> > > + *
> > > + * clang: https://clang.llvm.org/docs/AttributeReference.html#require-explicit-initialization
> > > + */
> > > +#if __has_attribute(__require_explicit_initialization__)
> > > +# define __require_explicit_initialization __attribute__((__require_explicit_initialization__))
> > > +#else
> > > +# define __require_explicit_initialization
> > > +#endif
> >
> > The LPC slides mention Clang 14+, but from a quick test in Compiler
> > Explorer and a `git log --grep` on the LLVM repository to confirm, it
> > seems the attribute was introduced in Clang 20+, no?
> >
> > If that is correct, then it is not available in all LLVM versions we
> > support (LLVM 17+), so we should add:
> >
> > * Optional: only supported since clang >= 20.0
> >
> > With that:
> >
> > Acked-by: Miguel Ojeda <ojeda at kernel.org>
>
> Yup, I can confirm, I only see it with 20+ too.
Fix up the comment and have a coin, witcher.
Reviewed-by: Nick Desaulniers <ndesaulniers at google.com>
>
> --
> Kees Cook
--
Thanks,
~Nick Desaulniers
More information about the linux-mtd
mailing list