ruby/ext/fiddle
Khem Raj f49bb1505b
[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>

ad6c9aa826
2023-01-27 11:30:13 +09:00
..
lib [ruby/fiddle] Prefer String#unpack1 in Fiddle::ValueUtil 2022-12-26 15:09:21 +09:00
win32 Import fiddle-1.0.4 (#3860) 2020-12-11 09:41:12 +09:00
closure.c [ruby/fiddle] Free closures immediately 2022-10-18 17:21:45 +09:00
closure.h ext: protoize no-arguments functions 2014-10-04 23:29:24 +00:00
conversions.c [ruby/fiddle] Add constants for unsigned values (https://github.com/ruby/fiddle/pull/111) 2022-10-07 15:18:49 +09:00
conversions.h [ruby/fiddle] Remove wrong comment 2021-05-18 12:48:40 +09:00
depend [Feature #18249] Update dependencies 2022-02-22 09:55:21 -05:00
extconf.rb Merge fiddle-1.1.1 2022-12-09 16:36:22 +09:00
fiddle.c [ruby/fiddle] Fix comment formatting 2023-01-27 11:30:13 +09:00
fiddle.gemspec Add --with-libffi-source-dir feature and removed --enable-bundled-libffi option. (#113) 2022-10-07 15:20:11 +09:00
fiddle.h [ruby/fiddle] fiddle: Use C11 _Alignof to define ALIGN_OF when 2023-01-27 11:30:13 +09:00
function.c [ruby/fiddle] windows: use GetLastError() for win32_last_error 2021-07-13 19:37:45 +09:00
function.h ext: protoize no-arguments functions 2014-10-04 23:29:24 +00:00
handle.c [ruby/fiddle] Add sym_defined? methods to test if a symbol is defined (https://github.com/ruby/fiddle/pull/108) 2022-10-07 15:18:51 +09:00
memory_view.c [ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86) 2021-07-14 18:55:59 +09:00
pinned.c [ruby/fiddle] Add a "pinning" reference (#44) 2020-11-18 09:05:13 +09:00
pointer.c [ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86) 2021-07-14 18:55:59 +09:00