Skip to content

Commit 846bb76

Browse files
committed
merge revision(s) bbf1130, 43dbb9a, 2bb6fe3, 7c9dd0e: [Backport #21629]
[PATCH] Add `RBIMPL_ATTR_NONSTRING_ARRAY()` macro for GCC 15 [PATCH] [Bug #21629] Enable `nonstring` attribute on clang 21 [PATCH] [Bug #21629] Initialize `struct RString` [PATCH] [Bug #21629] Initialize `struct RArray`
1 parent 9b5d650 commit 846bb76

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

enc/trans/iso2022.trans

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ rb_cp50221_encoder = {
437437

438438
/* JIS0201 to JIS0208 conversion table */
439439
enum {tbl0208_num = 0xDF - 0xA1 + 1};
440-
RBIMPL_ATTR_NONSTRING() static const char tbl0208[tbl0208_num][2] = {
440+
RBIMPL_ATTR_NONSTRING_ARRAY() static const char tbl0208[tbl0208_num][2] = {
441441
"\x21\x23", "\x21\x56", "\x21\x57", "\x21\x22",
442442
"\x21\x26", "\x25\x72", "\x25\x21", "\x25\x23",
443443
"\x25\x25", "\x25\x27", "\x25\x29", "\x25\x63",

include/ruby/internal/attr/nonstring.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,16 @@
2525
/** Wraps (or simulates) `__attribute__((nonstring))` */
2626
#if RBIMPL_HAS_ATTRIBUTE(nonstring)
2727
# define RBIMPL_ATTR_NONSTRING() __attribute__((nonstring))
28+
# if RBIMPL_COMPILER_SINCE(GCC, 15, 0, 0)
29+
# define RBIMPL_ATTR_NONSTRING_ARRAY() RBIMPL_ATTR_NONSTRING()
30+
# elif RBIMPL_COMPILER_SINCE(Clang, 21, 0, 0)
31+
# define RBIMPL_ATTR_NONSTRING_ARRAY() RBIMPL_ATTR_NONSTRING()
32+
# else
33+
# define RBIMPL_ATTR_NONSTRING_ARRAY() /* void */
34+
# endif
2835
#else
2936
# define RBIMPL_ATTR_NONSTRING() /* void */
37+
# define RBIMPL_ATTR_NONSTRING_ARRAY() /* void */
3038
#endif
3139

3240
#endif /* RBIMPL_ATTR_NONSTRING_H */

symbol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ rb_id_attrset(ID id)
156156

157157
/* make new symbol and ID */
158158
if (!(str = lookup_id_str(id))) {
159-
RBIMPL_ATTR_NONSTRING() static const char id_types[][8] = {
159+
RBIMPL_ATTR_NONSTRING_ARRAY() static const char id_types[][8] = {
160160
"local",
161161
"instance",
162162
"invalid",

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
1212
#define RUBY_VERSION_TEENY 7
1313
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
14-
#define RUBY_PATCHLEVEL 58
14+
#define RUBY_PATCHLEVEL 59
1515

1616
#include "ruby/version.h"
1717
#include "ruby/internal/abi.h"

vm_insnhelper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6259,7 +6259,7 @@ static VALUE
62596259
vm_opt_newarray_include_p(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr, VALUE target)
62606260
{
62616261
if (BASIC_OP_UNREDEFINED_P(BOP_INCLUDE_P, ARRAY_REDEFINED_OP_FLAG)) {
6262-
struct RArray fake_ary;
6262+
struct RArray fake_ary = {RBASIC_INIT};
62636263
VALUE ary = rb_setup_fake_ary(&fake_ary, ptr, num);
62646264
return rb_ary_includes(ary, target);
62656265
}
@@ -6279,7 +6279,7 @@ static VALUE
62796279
vm_opt_newarray_pack_buffer(rb_execution_context_t *ec, rb_num_t num, const VALUE *ptr, VALUE fmt, VALUE buffer)
62806280
{
62816281
if (BASIC_OP_UNREDEFINED_P(BOP_PACK, ARRAY_REDEFINED_OP_FLAG)) {
6282-
struct RArray fake_ary;
6282+
struct RArray fake_ary = {RBASIC_INIT};
62836283
VALUE ary = rb_setup_fake_ary(&fake_ary, ptr, num);
62846284
return rb_ec_pack_ary(ec, ary, fmt, (UNDEF_P(buffer) ? Qnil : buffer));
62856285
}

0 commit comments

Comments
 (0)