diff --git a/include/ruby/internal/core/rdata.h b/include/ruby/internal/core/rdata.h index bebb2a8822..f9ff3acc5f 100644 --- a/include/ruby/internal/core/rdata.h +++ b/include/ruby/internal/core/rdata.h @@ -143,8 +143,8 @@ struct RData { RUBY_DATA_FUNC dfree; /** Pointer to the actual C level struct that you want to wrap. - * This is in between dmark and dfree to allow DATA_PTR to continue - * to work for both RData and non-embedded RTypedData. + * This is after dmark and dfree to allow DATA_PTR to continue to work for + * both RData and non-embedded RTypedData. */ void *data; }; diff --git a/include/ruby/internal/core/rtypeddata.h b/include/ruby/internal/core/rtypeddata.h index 539a2f86d2..9441b2f5c2 100644 --- a/include/ruby/internal/core/rtypeddata.h +++ b/include/ruby/internal/core/rtypeddata.h @@ -37,6 +37,7 @@ #include "ruby/internal/dllexport.h" #include "ruby/internal/error.h" #include "ruby/internal/fl_type.h" +#include "ruby/internal/static_assert.h" #include "ruby/internal/stdbool.h" #include "ruby/internal/value_type.h" @@ -374,6 +375,8 @@ struct RTypedData { void *data; }; +RBIMPL_STATIC_ASSERT(data_in_rtypeddata, offsetof(struct RData, data) == offsetof(struct RTypedData, data)); + RBIMPL_SYMBOL_EXPORT_BEGIN() RBIMPL_ATTR_NONNULL((3)) /**