summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ruby/defines.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index da2ba24109..322df4c6d2 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -380,6 +380,16 @@ void rb_ia64_flushrs(void);
#define RUBY_ALIGNAS(x) y
#endif
+#ifdef RUBY_ALIGNOF
+/* OK, take that definition */
+#elif defined(__cplusplus) && (__cplusplus >= 201103L)
+#define RUBY_ALIGNOF alignof
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+#define RUBY_ALIGNOF _Alignof
+#else
+#define RUBY_ALIGNOF(x) ((size_t)offsetof(struct { char f1; type f2; }, f2))
+#endif
+
RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)