have embed.pl add PERL_CALLCONV_NO_RET to noreturn statics
authorDaniel Dragan <bulk88@hotmail.com>
Mon, 8 Oct 2012 06:13:22 +0000 (02:13 -0400)
committerSteve Hay <steve.m.hay@googlemail.com>
Tue, 9 Oct 2012 19:59:01 +0000 (20:59 +0100)
In commit 12a2785c7e8 PERL_CALLCONV_NO_RET was added to allow MS Visual C's
noreturn to work. In that commit, statics did not get a PERL_CALLCONV_NO_RET
so Visual C may not always figure out that a certain static is a noreturn.
This patch fixes that and allows statics to be Visual C noreturns. I
observed a drop in the .text section from 0xBEAAF to 0xBE8CF on no
DEBUGGING 32 bit VC 2003 -01 -GL/-LTCG after applying this.

proto.h
regen/embed.pl

diff --git a/proto.h b/proto.h
index cb70bc8..01d1e12 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5626,7 +5626,7 @@ STATIC void       S_hv_magic_check(HV *hv, bool *needs_copy, bool *needs_store)
 #define PERL_ARGS_ASSERT_HV_MAGIC_CHECK        \
        assert(hv); assert(needs_copy); assert(needs_store)
 
-STATIC void    S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen, const char *msg)
+PERL_CALLCONV_NO_RET STATIC void       S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen, const char *msg)
                        __attribute__noreturn__
                        __attribute__nonnull__(pTHX_2)
                        __attribute__nonnull__(pTHX_4);
@@ -5992,10 +5992,10 @@ STATIC SV*      S_mayberelocate(pTHX_ const char *const dir, STRLEN len, U32 flags)
 #define PERL_ARGS_ASSERT_MAYBERELOCATE \
        assert(dir)
 
-STATIC void    S_minus_v(pTHX)
+PERL_CALLCONV_NO_RET STATIC void       S_minus_v(pTHX)
                        __attribute__noreturn__;
 
-STATIC void    S_my_exit_jump(pTHX)
+PERL_CALLCONV_NO_RET STATIC void       S_my_exit_jump(pTHX)
                        __attribute__noreturn__;
 
 STATIC void    S_nuke_stacks(pTHX);
@@ -6006,10 +6006,10 @@ STATIC PerlIO * S_open_script(pTHX_ const char *scriptname, bool dosearch, bool
        assert(scriptname); assert(suidscript)
 
 STATIC void*   S_parse_body(pTHX_ char **env, XSINIT_t xsinit);
-STATIC void    S_run_body(pTHX_ I32 oldscope)
+PERL_CALLCONV_NO_RET STATIC void       S_run_body(pTHX_ I32 oldscope)
                        __attribute__noreturn__;
 
-STATIC void    S_usage(pTHX)
+PERL_CALLCONV_NO_RET STATIC void       S_usage(pTHX)
                        __attribute__noreturn__;
 
 #endif
@@ -6522,7 +6522,7 @@ STATIC char *     S_nextchar(pTHX_ struct RExC_state_t *pRExC_state)
 #define PERL_ARGS_ASSERT_NEXTCHAR      \
        assert(pRExC_state)
 
-STATIC void    S_re_croak2(pTHX_ const char* pat1, const char* pat2, ...)
+PERL_CALLCONV_NO_RET STATIC void       S_re_croak2(pTHX_ const char* pat1, const char* pat2, ...)
                        __attribute__noreturn__
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
@@ -7090,7 +7090,7 @@ STATIC I32        S_lop(pTHX_ I32 f, int x, char *s)
 #define PERL_ARGS_ASSERT_LOP   \
        assert(s)
 
-STATIC void    S_missingterm(pTHX_ char *s)
+PERL_CALLCONV_NO_RET STATIC void       S_missingterm(pTHX_ char *s)
                        __attribute__noreturn__;
 
 STATIC SV*     S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, STRLEN keylen, SV *sv, SV *pv, const char *type, STRLEN typelen)
@@ -7297,7 +7297,7 @@ STATIC SV *       S_with_queued_errors(pTHX_ SV *ex)
 #define PERL_ARGS_ASSERT_WITH_QUEUED_ERRORS    \
        assert(ex)
 
-STATIC char *  S_write_no_mem(pTHX)
+PERL_CALLCONV_NO_RET STATIC char *     S_write_no_mem(pTHX)
                        __attribute__noreturn__;
 
 #  if defined(PERL_MEM_LOG) && !defined(PERL_MEM_LOG_NOIMPL)
index 9f8a07a..a7419ba 100755 (executable)
@@ -89,6 +89,9 @@ my ($embed, $core, $ext, $api) = setup_embed();
            warn "$func: i and s flags are mutually exclusive"
                                            if $flags =~ /s/ && $flags =~ /i/;
            $retval = "$type $splint_flags$retval";
+           if ($never_returns) {
+               $retval = "PERL_CALLCONV_NO_RET $retval";
+           }
            $func = "S_$plain_func";
        }
        else {