Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0aa5e49c authored by Kees Cook's avatar Kees Cook
Browse files

compiler: Add __designated_init annotation

This allows structure annotations for requiring designated initialization
in GCC 5.1.0 and later:
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html



The structure randomization layout plugin will be using this to help
identify structures that need this form of initialization.

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 1132e1e4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -294,6 +294,14 @@
#define __no_sanitize_address __attribute__((no_sanitize_address))
#endif

#if GCC_VERSION >= 50100
/*
 * Mark structures as requiring designated initializers.
 * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
 */
#define __designated_init __attribute__((designated_init))
#endif

#endif	/* gcc version >= 40000 specific checks */

#if !defined(__noclone)
+4 −0
Original line number Diff line number Diff line
@@ -440,6 +440,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
# define __attribute_const__	/* unimplemented */
#endif

#ifndef __designated_init
# define __designated_init
#endif

#ifndef __latent_entropy
# define __latent_entropy
#endif