summaryrefslogtreecommitdiffstats
path: root/gl/stdalign.in.h
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-08-23 19:42:51 +0200
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-09-14 11:08:55 +0200
commit868beb15ae02c352005a2df8857f4ebb9bd758fd (patch)
tree0dc6e6a91c4ef0f131ca82a777e6ac2ad193c399 /gl/stdalign.in.h
parentb89aee56964f7d933f2da5f371e32b4d7db9410b (diff)
downloadmonitoring-plugins-868beb15ae02c352005a2df8857f4ebb9bd758fd.tar.gz
Sync with the latest Gnulib code (d27c820595)
Diffstat (limited to 'gl/stdalign.in.h')
-rw-r--r--gl/stdalign.in.h54
1 files changed, 36 insertions, 18 deletions
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h
index 7254a3de..3b117df1 100644
--- a/gl/stdalign.in.h
+++ b/gl/stdalign.in.h
@@ -1,19 +1,19 @@
1/* A substitute for ISO C11 <stdalign.h>. 1/* A substitute for ISO C11 <stdalign.h>.
2 2
3 Copyright 2011-2013 Free Software Foundation, Inc. 3 Copyright 2011-2022 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU Lesser General Public License as
7 the Free Software Foundation; either version 3, or (at your option) 7 published by the Free Software Foundation; either version 2.1 of the
8 any later version. 8 License, or (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU Lesser General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 17
18/* Written by Paul Eggert and Bruno Haible. */ 18/* Written by Paul Eggert and Bruno Haible. */
19 19
@@ -34,11 +34,12 @@
34 requirement of a structure member (i.e., slot or field) that is of 34 requirement of a structure member (i.e., slot or field) that is of
35 type TYPE, as an integer constant expression. 35 type TYPE, as an integer constant expression.
36 36
37 This differs from GCC's __alignof__ operator, which can yield a 37 This differs from GCC's and clang's __alignof__ operator, which can
38 better-performing alignment for an object of that type. For 38 yield a better-performing alignment for an object of that type. For
39 example, on x86 with GCC, __alignof__ (double) and __alignof__ 39 example, on x86 with GCC and on Linux/x86 with clang,
40 (long long) are 8, whereas alignof (double) and alignof (long long) 40 __alignof__ (double) and __alignof__ (long long) are 8, whereas
41 are 4 unless the option '-malign-double' is used. 41 alignof (double) and alignof (long long) are 4 unless the option
42 '-malign-double' is used.
42 43
43 The result cannot be used as a value for an 'enum' constant, if you 44 The result cannot be used as a value for an 'enum' constant, if you
44 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. 45 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
@@ -52,7 +53,13 @@
52#undef _Alignas 53#undef _Alignas
53#undef _Alignof 54#undef _Alignof
54 55
55#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 56/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
57 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
58 clang versions < 8.0.0 have the same bug. */
59#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
60 || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
61 && !defined __clang__) \
62 || (defined __clang__ && __clang_major__ < 8))
56# ifdef __cplusplus 63# ifdef __cplusplus
57# if 201103 <= __cplusplus 64# if 201103 <= __cplusplus
58# define _Alignof(type) alignof (type) 65# define _Alignof(type) alignof (type)
@@ -64,7 +71,9 @@
64# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) 71# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
65# endif 72# endif
66#endif 73#endif
67#define alignof _Alignof 74#if ! (defined __cplusplus && 201103 <= __cplusplus)
75# define alignof _Alignof
76#endif
68#define __alignof_is_defined 1 77#define __alignof_is_defined 1
69 78
70/* alignas (A), also known as _Alignas (A), aligns a variable or type 79/* alignas (A), also known as _Alignas (A), aligns a variable or type
@@ -95,14 +104,23 @@
95#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 104#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
96# if defined __cplusplus && 201103 <= __cplusplus 105# if defined __cplusplus && 201103 <= __cplusplus
97# define _Alignas(a) alignas (a) 106# define _Alignas(a) alignas (a)
98# elif __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC || 0x5110 <= __SUNPRO_C 107# elif (!defined __attribute__ \
108 && ((defined __APPLE__ && defined __MACH__ \
109 ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
110 : __GNUC__ && !defined __ibmxl__) \
111 || (4 <= __clang_major__) \
112 || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
113 || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__))
99# define _Alignas(a) __attribute__ ((__aligned__ (a))) 114# define _Alignas(a) __attribute__ ((__aligned__ (a)))
100# elif 1300 <= _MSC_VER 115# elif 1300 <= _MSC_VER
101# define _Alignas(a) __declspec (align (a)) 116# define _Alignas(a) __declspec (align (a))
102# endif 117# endif
103#endif 118#endif
104#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__) 119#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \
120 || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
105# define alignas _Alignas 121# define alignas _Alignas
122#endif
123#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus)
106# define __alignas_is_defined 1 124# define __alignas_is_defined 1
107#endif 125#endif
108 126