openat: don’t close (-1)
[gnulib.git] / lib / stdalign.in.h
blob317893fec7e15a2970be748f012f9a736b0daa8c
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
25 #if __GNUC__ >= 3
26 @PRAGMA_SYSTEM_HEADER@
27 #endif
28 @PRAGMA_COLUMNS@
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. */
32 #if @HAVE_STDALIGN_H@
33 /* The include_next requires a split double-inclusion guard. */
34 # @INCLUDE_NEXT@ @NEXT_STDALIGN_H@
35 #endif
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."
43 #endif
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
49 #endif
51 #define __alignof_is_defined 1
53 #endif /* _@GUARD_PREFIX@_STDALIGN_H */
54 #endif /* _@GUARD_PREFIX@_STDALIGN_H */