mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Suppress false warning by a bug of gcc
GCC [Bug 99578] seems triggered by calling `rb_reg_last_match` before `match_check(match)`, probably by `NIL_P(match)` in `rb_reg_nth_match`. [Bug 99578]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
This commit is contained in:
parent
4a7d6c2852
commit
001606097b
Notes:
git
2022-11-08 07:13:59 +00:00
1 changed files with 5 additions and 4 deletions
9
re.c
9
re.c
|
@ -1066,12 +1066,13 @@ update_char_offset(VALUE match)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static VALUE
|
||||||
match_check(VALUE match)
|
match_check(VALUE match)
|
||||||
{
|
{
|
||||||
if (!RMATCH(match)->regexp) {
|
if (!RMATCH(match)->regexp) {
|
||||||
rb_raise(rb_eTypeError, "uninitialized MatchData");
|
rb_raise(rb_eTypeError, "uninitialized MatchData");
|
||||||
}
|
}
|
||||||
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* :nodoc: */
|
/* :nodoc: */
|
||||||
|
@ -2268,16 +2269,16 @@ match_values_at(int argc, VALUE *argv, VALUE match)
|
||||||
static VALUE
|
static VALUE
|
||||||
match_to_s(VALUE match)
|
match_to_s(VALUE match)
|
||||||
{
|
{
|
||||||
VALUE str = rb_reg_last_match(match);
|
VALUE str = rb_reg_last_match(match_check(match));
|
||||||
|
|
||||||
match_check(match);
|
|
||||||
if (NIL_P(str)) str = rb_str_new(0,0);
|
if (NIL_P(str)) str = rb_str_new(0,0);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
match_named_captures_iter(const OnigUChar *name, const OnigUChar *name_end,
|
match_named_captures_iter(const OnigUChar *name, const OnigUChar *name_end,
|
||||||
int back_num, int *back_refs, OnigRegex regex, void *arg) {
|
int back_num, int *back_refs, OnigRegex regex, void *arg)
|
||||||
|
{
|
||||||
struct MEMO *memo = MEMO_CAST(arg);
|
struct MEMO *memo = MEMO_CAST(arg);
|
||||||
VALUE hash = memo->v1;
|
VALUE hash = memo->v1;
|
||||||
VALUE match = memo->v2;
|
VALUE match = memo->v2;
|
||||||
|
|
Loading…
Reference in a new issue