mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0641e1fc0e
commit
50ae750646
3 changed files with 20 additions and 5 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Wed Jul 15 00:03:36 2015 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||
|
||||
* 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@mbf.nifty.com>
|
||||
|
||||
* random.c (fill_random_bytes_syscall): fix compile error with
|
||||
|
|
4
gc.c
4
gc.c
|
@ -35,10 +35,6 @@
|
|||
|
||||
#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
|
||||
|
|
10
internal.h
10
internal.h
|
@ -73,7 +73,15 @@ extern "C" {
|
|||
(__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)]
|
||||
|
|
Loading…
Reference in a new issue