1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
卜部昌平 2020-09-26 00:19:09 +09:00
parent f7c4118263
commit 722a1e479f

View file

@ -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.