ruby-changes:66040
From: Benoit <ko1@a...>
Date: Tue, 4 May 2021 21:57:12 +0900 (JST)
Subject: [ruby-changes:66040] f1dcc3da5d (master): Add RBIMPL_RVALUE_EMBED_LEN_MAX neeeded by internal/bignum.h
https://git.ruby-lang.org/ruby.git/commit/?id=f1dcc3da5d From f1dcc3da5d89b0a03cbc280e7eafb845d63a1f6a Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Thu, 29 Apr 2021 14:28:08 +0200 Subject: Add RBIMPL_RVALUE_EMBED_LEN_MAX neeeded by internal/bignum.h * It evaluated to 0 before, revealed by -Wundef * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@g...> --- include/ruby/internal/core/rbasic.h | 5 +++-- internal/bignum.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/ruby/internal/core/rbasic.h b/include/ruby/internal/core/rbasic.h index a6093c0..aafec24 100644 --- a/include/ruby/internal/core/rbasic.h +++ b/include/ruby/internal/core/rbasic.h @@ -37,10 +37,11 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/core/rbasic.h#L37 /** @cond INTERNAL_MACRO */ #define RBIMPL_EMBED_LEN_MAX_OF(T) \ - RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / (sizeof(T)))) + RBIMPL_CAST((int)(sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX]) / (sizeof(T)))) /** @endcond */ -enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = 3 }; +#define RBIMPL_RVALUE_EMBED_LEN_MAX 3 +enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = RBIMPL_RVALUE_EMBED_LEN_MAX }; struct RUBY_ALIGNAS(SIZEOF_VALUE) diff --git a/internal/bignum.h b/internal/bignum.h index aaada45..9b89e61 100644 --- a/internal/bignum.h +++ b/internal/bignum.h @@ -83,8 +83,8 @@ https://github.com/ruby/ruby/blob/trunk/internal/bignum.h#L83 #define BIGNUM_EMBED_LEN_SHIFT \ (FL_USHIFT+3) /* bit offset of BIGNUM_EMBED_LEN_MASK */ #ifndef BIGNUM_EMBED_LEN_MAX -# if (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1 -# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) +# if (SIZEOF_VALUE*RBIMPL_RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1 +# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RBIMPL_RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) # else # define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1) # endif -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/