From dd04b8034bf08243fc14763c2b4fb5490da626d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Wed, 8 Apr 2020 22:32:02 +0900 Subject: 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. --- include/ruby/3/core/rarray.h | 2 +- include/ruby/3/core/rstring.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include/ruby/3') 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() -- cgit v1.2.3