From 0b77a86d1ec3a8bb3d62ea38a93d7aed44dd2c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Wed, 23 Sep 2020 14:29:05 +0900 Subject: ext/-test-/RUBY_ALIGNOF: add minimalistic test Check if RUBY_ALIGNOF(double) is the alignment to store a double inside of a struct. --- ext/-test-/RUBY_ALIGNOF/cpp.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ext/-test-/RUBY_ALIGNOF/cpp.cpp (limited to 'ext/-test-/RUBY_ALIGNOF/cpp.cpp') diff --git a/ext/-test-/RUBY_ALIGNOF/cpp.cpp b/ext/-test-/RUBY_ALIGNOF/cpp.cpp new file mode 100644 index 0000000000..ea1211c38c --- /dev/null +++ b/ext/-test-/RUBY_ALIGNOF/cpp.cpp @@ -0,0 +1,15 @@ +#include "ruby.h" +#include + +struct T { + char _; + double t; +}; + +RBIMPL_STATIC_ASSERT(RUBY_ALIGNOF, RUBY_ALIGNOF(double) == offsetof(T, t)); + +extern "C" void +Init_RUBY_ALIGNOF() +{ + // Windows linker mandates this symbol to exist. +} -- cgit v1.2.3