diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-04-08 22:32:02 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-04-08 22:32:02 +0900 |
commit | dd04b8034bf08243fc14763c2b4fb5490da626d7 (patch) | |
tree | c9008d62cdafcc64883d635db7d6f3818f189190 /include/ruby/3/core | |
parent | ec1b3464da9ed2d891beb344efc5881532f2ac3a (diff) |
RARRAY_EMBED_LEN/RSTRING_EMBED_LEN: add RUBY3_CAST
RUBY3_CAST is a macro to suppress g++/clang++ warnings about C-style
casts. Though Ruby core don't have to bother C++ situations, extension
libraries can benefit from this.
Diffstat (limited to 'include/ruby/3/core')
-rw-r--r-- | include/ruby/3/core/rarray.h | 2 | ||||
-rw-r--r-- | include/ruby/3/core/rstring.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/ruby/3/core/rarray.h b/include/ruby/3/core/rarray.h index f4f6809874..cd8767a8a8 100644 --- a/include/ruby/3/core/rarray.h +++ b/include/ruby/3/core/rarray.h @@ -123,7 +123,7 @@ RARRAY_EMBED_LEN(VALUE ary) VALUE f = RBASIC(ary)->flags; f &= RARRAY_EMBED_LEN_MASK; f >>= RARRAY_EMBED_LEN_SHIFT; - return (long)f; + return RUBY3_CAST((long)f); } RUBY3_ATTR_PURE_ON_NDEBUG() diff --git a/include/ruby/3/core/rstring.h b/include/ruby/3/core/rstring.h index 3d40f850bc..80e997b494 100644 --- a/include/ruby/3/core/rstring.h +++ b/include/ruby/3/core/rstring.h @@ -108,7 +108,7 @@ RSTRING_EMBED_LEN(VALUE str) VALUE f = RBASIC(str)->flags; f &= RSTRING_EMBED_LEN_MASK; f >>= RSTRING_EMBED_LEN_SHIFT; - return (long)f; + return RUBY3_CAST((long)f); } RUBY3_ATTR_PURE_ON_NDEBUG() |