This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
embed.fnc: Make re_croak a format fcn
authorKarl Williamson <khw@cpan.org>
Thu, 27 Feb 2020 14:56:17 +0000 (07:56 -0700)
committerKarl Williamson <khw@cpan.org>
Sun, 1 Mar 2020 16:02:08 +0000 (09:02 -0700)
This enables compiler warnings when argument types don't match the
format

embed.fnc
proto.h

index 44d5fb9..bb0c3e4 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2710,7 +2710,7 @@ ES        |SSize_t|study_chunk    |NN RExC_state_t *pRExC_state \
 ESR    |SV *   |get_ANYOFM_contents|NN const regnode * n
 ESRT   |U32    |add_data       |NN RExC_state_t* const pRExC_state \
                                |NN const char* const s|const U32 n
-rS     |void   |re_croak       |bool utf8|NN const char* pat|...
+frS    |void   |re_croak       |bool utf8|NN const char* pat|...
 ES     |int    |handle_possible_posix                                      \
                                |NN RExC_state_t *pRExC_state               \
                                |NN const char* const s                     \
diff --git a/proto.h b/proto.h
index 582bd18..1250970 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5687,7 +5687,8 @@ STATIC void       S_populate_ANYOF_from_invlist(pTHX_ regnode *node, SV** invlist_ptr)
 #define PERL_ARGS_ASSERT_POPULATE_ANYOF_FROM_INVLIST   \
        assert(node); assert(invlist_ptr)
 PERL_STATIC_NO_RET void        S_re_croak(pTHX_ bool utf8, const char* pat, ...)
-                       __attribute__noreturn__;
+                       __attribute__noreturn__
+                       __attribute__format__(__printf__,pTHX_2,pTHX_3);
 #define PERL_ARGS_ASSERT_RE_CROAK      \
        assert(pat)