[前][次][番号順一覧][スレッド一覧]

ruby-changes:63138

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Sat, 26 Sep 2020 00:30:50 +0900 (JST)
Subject: [ruby-changes:63138] 722a1e479f (master): RBIMPL_ALIGNAS: reorder #ifdef blocks

https://git.ruby-lang.org/ruby.git/commit/?id=722a1e479f

From 722a1e479f9f0d517024eb3f4959cc33f4be4383 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Sat, 26 Sep 2020 00:19:09 +0900
Subject: 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.

diff --git a/include/ruby/internal/stdalign.h b/include/ruby/internal/stdalign.h
index 122f649..ff90f2f 100644
--- a/include/ruby/internal/stdalign.h
+++ b/include/ruby/internal/stdalign.h
@@ -83,11 +83,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/stdalign.h#L83
  * @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 { https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/stdalign.h#L107
 # /* 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.
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]