This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
APItest.xs: Fix compile warning: format ‘%d’ expects argument of type ‘int’, but...
authorPali <pali@cpan.org>
Tue, 10 Dec 2019 14:26:19 +0000 (15:26 +0100)
committerKarl Williamson <khw@cpan.org>
Tue, 10 Dec 2019 19:25:40 +0000 (12:25 -0700)
Use "%u" format modifier instead of "%d" as line_t is unsigned. Type line_t
is of U32 type and therefore casting it to unsigned int is safe on most
platforms.

ext/XS-APItest/APItest.xs

index 34c602f..fcaea38 100644 (file)
@@ -1084,7 +1084,7 @@ static OP *THX_parse_keyword_subsignature(pTHX)
                seen_nextstate++;
                retop = op_append_list(OP_LIST, retop, newSVOP(OP_CONST, 0,
                    /* newSVpvf("nextstate:%s:%d", CopFILE(cCOPx(kid)), cCOPx(kid)->cop_line))); */
-                   newSVpvf("nextstate:%d", cCOPx(kid)->cop_line)));
+                   newSVpvf("nextstate:%u", (unsigned int)cCOPx(kid)->cop_line)));
                break;
            case OP_ARGCHECK: {
                UNOP_AUX_item *aux = cUNOP_AUXx(kid)->op_aux;