diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-01-24 17:54:33 -0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-01-27 11:30:13 +0900 |
commit | f49bb1505b854253b4f993ca9b95836bde37feb5 (patch) | |
tree | aa420a1656bc378cdc0604ad42b3d6bb1ee80966 /tool | |
parent | f4609b6bc442bebee7bad2ee8d4bef46b288b7ba (diff) |
[ruby/fiddle] fiddle: Use C11 _Alignof to define ALIGN_OF when
possible
(https://github.com/ruby/fiddle/pull/120)
WG14 N2350 made very clear that it is an UB having type definitions
within "offsetof" [1]. This patch enhances the implementation of macro
ALIGN_OF to use builtin "_Alignof" to avoid undefined behavior when
using std=c11 or newer
clang 16+ has started to flag this [2]
Fixes build when using -std >= gnu11 and using clang16+
Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
may support C11, exclude those compiler versions
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
[2] https://reviews.llvm.org/D133574
Signed-off-by: Khem Raj <raj.khem@gmail.com>
https://github.com/ruby/fiddle/commit/ad6c9aa826
Diffstat (limited to 'tool')
0 files changed, 0 insertions, 0 deletions