summaryrefslogtreecommitdiff
path: root/include/ruby/internal/stdalign.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/internal/stdalign.h')
-rw-r--r--include/ruby/internal/stdalign.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/ruby/internal/stdalign.h b/include/ruby/internal/stdalign.h
index 122f649b37..ec68f6a882 100644
--- a/include/ruby/internal/stdalign.h
+++ b/include/ruby/internal/stdalign.h
@@ -17,7 +17,7 @@
* recursively included from extension libraries written in C++.
* Do not expect for instance `__VA_ARGS__` is always available.
* We assume C99 for ruby itself but we don't assume languages of
- * extension libraries. They could be written in C++98.
+ * extension libraries. They could be written in C++98.
* @brief Defines #RBIMPL_ALIGNAS / #RBIMPL_ALIGNOF
*/
#include "ruby/internal/config.h"
@@ -65,7 +65,7 @@
#elif RBIMPL_HAS_DECLSPEC_ATTRIBUTE(align)
# define RBIMPL_ALIGNAS(_) __declspec(align(_))
-#elif RBIMPL_HAS_ATTRIBUTE(aliged)
+#elif RBIMPL_HAS_ATTRIBUTE(aligned)
# define RBIMPL_ALIGNAS(_) __attribute__((__aligned__(_)))
#else
@@ -83,10 +83,8 @@
* @see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69560
* @see https://bugs.llvm.org/show_bug.cgi?id=26547
*/
-#if defined(__STDC_VERSION__) && defined(HAVE__ALIGNOF)
-# /* Autoconf detected availability of a sane `_Alignof()`. */
-# define RBIMPL_ALIGNOF(T) RB_GNUC_EXTENSION(_Alignof(T))
-
+#if defined(__DOXYGEN__)
+# define RBIMPL_ALIGNOF alignof
#elif defined(__cplusplus)
# /* C++11 `alignof()` can be buggy. */
# /* see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69560 */
@@ -111,13 +109,17 @@ struct rbimpl_alignof {
# /* Windows have no alignment glitch.*/
# define RBIMPL_ALIGNOF __alignof
+#elif defined(HAVE__ALIGNOF)
+# /* Autoconf detected availability of a sane `_Alignof()`. */
+# define RBIMPL_ALIGNOF(T) RB_GNUC_EXTENSION(_Alignof(T))
+
#else
# /* :BEWARE: This is the last resort. If your compiler somehow supports
# * querying the alignment of a type, you definitely should use that instead.
# * There are 2 known pitfalls for this fallback implementation:
# *
-# * Fitst, it is either an undefined behaviour (C) or an explicit error (C++)
-# * to define a struct inside of `offsetof`. C compilers tend to accept such
+# * First, it is either an undefined behaviour (C) or an explicit error (C++)
+# * to define a struct inside of `offsetof`. C compilers tend to accept such
# * things, but AFAIK C++ has no room to allow.
# *
# * Second, there exist T such that `struct { char _; T t; }` is invalid. A