diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2014-05-12 17:32:29 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2014-05-12 17:32:29 +0000 |
commit | e0c3dac5c8c5e7789438380f2ad1341055a10360 (patch) | |
tree | 4011f6b53b1350322301b1aa0ea35d2103f8ae7e /lib/Headers/stddef.h | |
parent | 04f1f071a854e18275ec5c9c341400e2ecff14eb (diff) | |
download | clang-e0c3dac5c8c5e7789438380f2ad1341055a10360.tar.gz clang-e0c3dac5c8c5e7789438380f2ad1341055a10360.tar.bz2 clang-e0c3dac5c8c5e7789438380f2ad1341055a10360.tar.xz |
Merging r201729:
------------------------------------------------------------------------
r201729 | chandlerc | 2014-02-19 17:35:01 -0500 (Wed, 19 Feb 2014) | 21 lines
Teach Clang to provide ::max_align_t in C11 and C++11 modes.
This definition is not chosen idly. There is an unfortunate reality with
max_align_t -- the specific nature of its definition leaks into the ABI
almost immediately. Because it is part of C11 and C++11 it becomes
essential for it to match with other systems on that ABI. There is an
effort to discourage any further use of this construct as a consequence
-- using max_align_t introduces an immediate ABI problem. We can never
update it to have larger alignment even as the microarchitecture changes
to necessitate higher alignment. =/
The particular definition here exactly matches the ABI of GCC's chosen
::max_align_t definition, for better or worse. This was written with the
help of Richard Smith who was decoding the exact ABI implications of the
selected definition in GCC. Notably, in-register arguments are impacted
by the particular definition chosen. =/
No one is under the illusion that this is a "good" or "useful"
definition of max_align_t, and we are working with the standards
committee to specify a more useful interface to address this need.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@208600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Headers/stddef.h')
-rw-r--r-- | lib/Headers/stddef.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Headers/stddef.h b/lib/Headers/stddef.h index 6a64d6d32a..b6926942ef 100644 --- a/lib/Headers/stddef.h +++ b/lib/Headers/stddef.h @@ -84,6 +84,16 @@ using ::std::nullptr_t; #endif #endif +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L +typedef struct { + long long __clang_max_align_nonce1 + __attribute__((__aligned__(__alignof__(long long)))); + long double __clang_max_align_nonce2 + __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +#define __CLANG_MAX_ALIGN_T_DEFINED +#endif + #define offsetof(t, d) __builtin_offsetof(t, d) #endif /* __STDDEF_H */ |