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

ruby-changes:49445

From: shyouhei <ko1@a...>
Date: Tue, 2 Jan 2018 20:29:34 +0900 (JST)
Subject: [ruby-changes:49445] shyouhei:r61555 (trunk): _Static_assert is a C11ism

shyouhei	2018-01-02 15:41:51 +0900 (Tue, 02 Jan 2018)

  New Revision: 61555

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61555

  Log:
    _Static_assert is a C11ism

  Modified files:
    trunk/internal.h
Index: internal.h
===================================================================
--- internal.h	(revision 61554)
+++ internal.h	(revision 61555)
@@ -79,8 +79,10 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/internal.h#L79
 # define __has_extension __has_feature
 #endif
 
-#if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
 # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
+#elif GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
+# define STATIC_ASSERT(name, expr) RB_GNUC_EXTENSION _Static_assert(expr, #name ": " #expr)
 #else
 # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
 #endif

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

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