From f90968ace4cbd183851717fdd9243ad5777f3622 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 27 May 2020 11:48:36 +0800 Subject: [PATCH] stddef.h: Add max_align_t typedef defined by C11: https://en.cppreference.com/w/c/types/max_align_t Signed-off-by: Xiang Xiao Change-Id: I6f6094d054c475031ff83f648aa43f482d86b930 --- include/stddef.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/stddef.h b/include/stddef.h index de8944e505..8e9ce752a6 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -99,4 +99,24 @@ * Reference: Opengroup.org */ +/* Type whose alignment is supported in every context and is at least + * as great as that of any standard type not using alignment specifiers. + */ + +typedef struct +{ +#if defined(CONFIG_HAVE_LONG_LONG) + long long max_align_i; +#else + long max_align_i; +#endif +#if defined(CONFIG_HAVE_LONG_DOUBLE) + long double max_align_f; +#elif defined(CONFIG_HAVE_DOUBLE) + double max_align_f; +#elif defined(CONFIG_HAVE_FLOAT) + float max_align_f; +#endif +} max_align_t; + #endif /* __INCLUDE_STDDEF_H */