ext/-test-/RUBY_ALIGNOF: add minimalistic test

Check if RUBY_ALIGNOF(double) is the alignment to store a double inside
of a struct.
This commit is contained in:
卜部昌平 2020-09-23 14:29:05 +09:00
parent 873fb1aa4c
commit 0b77a86d1e
Notes: git 2020-09-25 11:39:05 +09:00
4 changed files with 189 additions and 0 deletions

View file

@ -0,0 +1,15 @@
#include "ruby.h"
#include <cstddef>
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.
}