1 /* A substitute for ISO C11 <stdalign.h>.
3 Copyright 2011-2024 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* Written by Paul Eggert and Bruno Haible. */
20 /* Define two obsolescent C11 macros, assuming alignas and alignof are
21 either keywords or alignasof-defined macros. */
23 #ifndef _@GUARD_PREFIX@_STDALIGN_H
26 @PRAGMA_SYSTEM_HEADER@
30 /* We need to include the system's <stdalign.h> when it exists, because it might
31 define 'alignof' as a macro when it's not a keyword or compiler built-in. */
33 /* The include_next requires a split double-inclusion guard. */
34 # @INCLUDE_NEXT@ @NEXT_STDALIGN_H@
37 #ifndef _@GUARD_PREFIX@_STDALIGN_H
38 #define _@GUARD_PREFIX@_STDALIGN_H
40 /* This file uses alignof, alignas. */
41 #if !_GL_CONFIG_H_INCLUDED
42 #error "Please include config.h first."
45 #if (defined alignas \
46 || (defined __STDC_VERSION__ && 202311 <= __STDC_VERSION__) \
47 || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)))
48 # define __alignas_is_defined 1
51 #define __alignof_is_defined 1
53 #endif /* _@GUARD_PREFIX@_STDALIGN_H */
54 #endif /* _@GUARD_PREFIX@_STDALIGN_H */