From fce4124fa70860bf2675923721139e9b376b0856 Mon Sep 17 00:00:00 2001 From: TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> Date: Wed, 26 Oct 2022 23:59:10 +0900 Subject: op.c: Add a cast to silence -Wsign-compare warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In 32-bit build (where IV is not wider than U32), comparing PL_eval_begin_nest_depth and max_nest_iv would generate a warning: op.c:10817:42: warning: comparison of integer expressions of different signedness: ‘U32’ {aka ‘long unsigned int’} and ‘IV’ {aka ‘long int’} [-Wsign-compare] 10817 | if (PL_eval_begin_nest_depth >= max_nest_iv) { | ^~ --- op.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'op.c') diff --git a/op.c b/op.c index a4d714758a..55f8c6adcb 100644 --- a/op.c +++ b/op.c @@ -10818,7 +10818,10 @@ S_process_special_blocks(pTHX_ I32 floor, const char *const fullname, sv_setiv(max_nest_sv, max_nest_iv); } - if (PL_eval_begin_nest_depth >= max_nest_iv) { + /* (UV) below is just to silence a compiler warning, and should be + * effectively a no-op, as max_nest_iv will never be negative here. + */ + if (PL_eval_begin_nest_depth >= (UV)max_nest_iv) { Perl_croak(aTHX_ "Too many nested BEGIN blocks, maximum of %" IVdf " allowed", max_nest_iv); } -- cgit v1.2.1