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

ruby-changes:39161

From: kazu <ko1@a...>
Date: Wed, 15 Jul 2015 00:09:32 +0900 (JST)
Subject: [ruby-changes:39161] kazu:r51242 (trunk): use _Static_assert with clang

kazu	2015-07-15 00:09:23 +0900 (Wed, 15 Jul 2015)

  New Revision: 51242

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

  Log:
    use _Static_assert with clang
    
    * gc.c (__has_feature): move into internal.h.
    
    * internal.h (__has_feature): ditto.
    
    * internal.h (__has_extension): new macro.
    
    * internal.h (STATIC_ASSERT): use _Static_assert with
      clang. [ruby-core:69931] [Bug #11343]

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/internal.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51241)
+++ ChangeLog	(revision 51242)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jul 15 00:03:36 2015  Kazuhiro NISHIYAMA  <zn@m...>
+
+	* gc.c (__has_feature): move into internal.h.
+
+	* internal.h (__has_feature): ditto.
+
+	* internal.h (__has_extension): new macro.
+
+	* internal.h (STATIC_ASSERT): use _Static_assert with
+	  clang. [ruby-core:69931] [Bug #11343]
+
 Wed Jul 15 00:00:00 2015  Kazuhiro NISHIYAMA  <zn@m...>
 
 	* random.c (fill_random_bytes_syscall): fix compile error with
Index: gc.c
===================================================================
--- gc.c	(revision 51241)
+++ gc.c	(revision 51242)
@@ -35,10 +35,6 @@ https://github.com/ruby/ruby/blob/trunk/gc.c#L35
 
 #undef rb_data_object_wrap
 
-#ifndef __has_feature
-# define __has_feature(x) 0
-#endif
-
 #ifndef HAVE_MALLOC_USABLE_SIZE
 # ifdef _WIN32
 #   define HAVE_MALLOC_USABLE_SIZE
Index: internal.h
===================================================================
--- internal.h	(revision 51241)
+++ internal.h	(revision 51242)
@@ -73,7 +73,15 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/internal.h#L73
     (__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
     (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
 
-#if GCC_VERSION_SINCE(4, 6, 0)
+#ifndef __has_feature
+# define __has_feature(x) 0
+#endif
+
+#ifndef __has_extension
+# define __has_extension __has_feature
+#endif
+
+#if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
 # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
 #else
 # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]

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

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