summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-09-26 00:19:09 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-09-26 00:30:36 +0900
commit722a1e479f9f0d517024eb3f4959cc33f4be4383 (patch)
tree084c20b03c0bde9bb599a230104e0d7316bf7490 /include
parentf7c4118263f64667a4e34181cbf21f101f6ec737 (diff)
RBIMPL_ALIGNAS: reorder #ifdef blocks
Since r63443, `-std=gnu99 -D_XOPEN_SOUCE=x00` is added to Solaris' `CPPFLAGS`. `CPPFLAGS` is shared among `CC` / `CXX`. This results in both `__STDC_VERSION__` and `__cplusplus` to be defined at the same time for a C++ compilation, only on Solaris. It seems the `CPPFLAGS` addition is intentional. We sould not touch that part. Instead we need to reroute this by always check for `__cplusplus` first.
Diffstat (limited to 'include')
-rw-r--r--include/ruby/internal/stdalign.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/ruby/internal/stdalign.h b/include/ruby/internal/stdalign.h
index 122f649b37..ff90f2f0d1 100644
--- a/include/ruby/internal/stdalign.h
+++ b/include/ruby/internal/stdalign.h
@@ -83,11 +83,7 @@
* @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))
-
-#elif defined(__cplusplus)
+#if defined(__cplusplus)
# /* C++11 `alignof()` can be buggy. */
# /* see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69560 */
# /* But don't worry, we can use templates. */
@@ -111,6 +107,10 @@ 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.