diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-11-15 21:00:16 -0500 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-15 22:17:42 -0800 |
commit | f8d5a52263698f3448751c5ac18d2b5edac28b36 (patch) | |
tree | 19b0723c7099256a9d5e6591d9100c4739fc131f | |
parent | c1f06047c0ded9ef04cacab9735c6c65fa803b18 (diff) | |
download | perl-f8d5a52263698f3448751c5ac18d2b5edac28b36.tar.gz |
readd noreturn and silence "noreturn that returns" warning on MSVC
Based on commit 73758d77 (by me), in commit 117af67d629 more things got
noreturn removed on MSVC. See also ML post
"(Hugmeir) Re: [perl.git] branch blead, updated. v5.21.0-377-gdc3bf40"
This caused a measurable increase in machine code size in 117af67d629 .
In commit 73758d77 , the reason there was no increase is
Perl_magic_regdatum_set is called only through a magic vtable. Optimizing
this to noreturn is forbidden unless the struct member type specifies it
(and it obviously doesn't, since this is the magic vtable).
The other not-noreturn on MSVC function, Perl_screaminstr, has no core
usage (its only reference is in the export table) or CPAN grep usage so
therefore it is being removed. It was made fatal in commit 9e3f0d16db .
before .text section of perl521.dll on VC 2003 32b, 0xc66a3 bytes, after
0xc6453
-rw-r--r-- | embed.fnc | 22 | ||||
-rw-r--r-- | embed.h | 25 | ||||
-rw-r--r-- | pod/perldelta.pod | 4 | ||||
-rw-r--r-- | proto.h | 58 | ||||
-rw-r--r-- | util.c | 47 |
5 files changed, 54 insertions, 102 deletions
@@ -281,12 +281,7 @@ norx |void |win32_croak_not_implemented|NN const char * fname #endif #if defined(PERL_IMPLICIT_CONTEXT) Afnrp |void |croak_nocontext|NULLOK const char* pat|... -:removing noreturn to silence a warning -#ifdef _MSC_VER -Afnp |OP* |die_nocontext |NULLOK const char* pat|... -#else Afnrp |OP* |die_nocontext |NULLOK const char* pat|... -#endif Afnp |void |deb_nocontext |NN const char* pat|... Afnp |char* |form_nocontext |NN const char* pat|... Anp |void |load_module_nocontext|U32 flags|NN SV* name|NULLOK SV* ver|... @@ -343,14 +338,8 @@ Anp |char* |delimcpy |NN char* to|NN const char* toend|NN const char* from \ |NN const char* fromend|int delim|NN I32* retlen : Used in op.c, perl.c pM |void |delete_eval_scope -:removing noreturn to silence a warning -#ifdef _MSC_VER -Apd |OP* |die_sv |NN SV *baseex -Afpd |OP* |die |NULLOK const char* pat|... -#else Aprd |OP* |die_sv |NN SV *baseex Afrpd |OP* |die |NULLOK const char* pat|... -#endif : Used in util.c pr |void |die_unwind |NN SV* msv Ap |void |dounwind |I32 cxix @@ -850,7 +839,8 @@ p |int |magic_nextpack |NN SV *sv|NN MAGIC *mg|NN SV *key p |U32 |magic_regdata_cnt|NN SV* sv|NN MAGIC* mg p |int |magic_regdatum_get|NN SV* sv|NN MAGIC* mg :removing noreturn to silence a warning for this function resulted in no -:change to the interpreter DLL image under VS 2003 -O1 -GL 32 bits +:change to the interpreter DLL image under VS 2003 -O1 -GL 32 bits only because +:this is used in a magic vtable, do not use this on conventionally called funcs #ifdef _MSC_VER p |int |magic_regdatum_set|NN SV* sv|NN MAGIC* mg #else @@ -1322,14 +1312,6 @@ Apd |NV |scan_hex |NN const char* start|STRLEN len|NN STRLEN* retlen Ap |char* |scan_num |NN const char* s|NN YYSTYPE *lvalp Apd |NV |scan_oct |NN const char* start|STRLEN len|NN STRLEN* retlen AMpd |OP* |op_scope |NULLOK OP* o -:removing noreturn to silence a warning -#ifdef _MSC_VER -Ap |char* |screaminstr |NN SV *bigstr|NN SV *littlestr|I32 start_shift \ - |I32 end_shift|NN I32 *old_posp|I32 last -#else -Apr |char* |screaminstr |NN SV *bigstr|NN SV *littlestr|I32 start_shift \ - |I32 end_shift|NN I32 *old_posp|I32 last -#endif : Only used by perl.c/miniperl.c, but defined in caretx.c px |void |set_caret_X Apd |void |setdefout |NN GV* gv @@ -117,6 +117,10 @@ #define debstackptrs() Perl_debstackptrs(aTHX) #define delimcpy Perl_delimcpy #define despatch_signals() Perl_despatch_signals(aTHX) +#ifndef PERL_IMPLICIT_CONTEXT +#define die Perl_die +#endif +#define die_sv(a) Perl_die_sv(aTHX_ a) #define do_binmode(a,b,c) Perl_do_binmode(aTHX_ a,b,c) #define do_close(a,b) Perl_do_close(aTHX_ a,b) #define do_gv_dump(a,b,c,d) Perl_do_gv_dump(aTHX_ a,b,c,d) @@ -750,16 +754,6 @@ #if !(defined(NO_MATHOMS)) #define sv_nounlocking(a) Perl_sv_nounlocking(aTHX_ a) #endif -#if !(defined(_MSC_VER)) -#ifndef PERL_IMPLICIT_CONTEXT -#define die Perl_die -#endif -#define die_sv(a) Perl_die_sv(aTHX_ a) -#define screaminstr(a,b,c,d,e,f) Perl_screaminstr(aTHX_ a,b,c,d,e,f) -# if defined(PERL_IMPLICIT_CONTEXT) -#define die_nocontext Perl_die_nocontext -# endif -#endif #if !defined(HAS_BZERO) && !defined(HAS_MEMSET) #define my_bzero Perl_my_bzero #endif @@ -805,6 +799,7 @@ #if defined(PERL_IMPLICIT_CONTEXT) #define croak_nocontext Perl_croak_nocontext #define deb_nocontext Perl_deb_nocontext +#define die_nocontext Perl_die_nocontext #define form_nocontext Perl_form_nocontext #define fprintf_nocontext Perl_fprintf_nocontext #define load_module_nocontext Perl_load_module_nocontext @@ -817,9 +812,6 @@ #define sv_setpvf_nocontext Perl_sv_setpvf_nocontext #define warn_nocontext Perl_warn_nocontext #define warner_nocontext Perl_warner_nocontext -# if defined(_MSC_VER) -#define die_nocontext Perl_die_nocontext -# endif #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_PERL_C) || defined(PERL_IN_UTF8_C) #define _new_invlist_C_array(a) Perl__new_invlist_C_array(aTHX_ a) @@ -896,13 +888,6 @@ #define do_spawn(a) Perl_do_spawn(aTHX_ a) #define do_spawn_nowait(a) Perl_do_spawn_nowait(aTHX_ a) #endif -#if defined(_MSC_VER) -#ifndef PERL_IMPLICIT_CONTEXT -#define die Perl_die -#endif -#define die_sv(a) Perl_die_sv(aTHX_ a) -#define screaminstr(a,b,c,d,e,f) Perl_screaminstr(aTHX_ a,b,c,d,e,f) -#endif #if defined(PERL_CORE) || defined(PERL_EXT) #define av_reify(a) Perl_av_reify(aTHX_ a) #define current_re_engine() Perl_current_re_engine(aTHX) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index c893a8ed2e..1e4e7b2c7f 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -383,7 +383,9 @@ well. =item * -XXX +C<screaminstr> has been removed. Although marked as public API, it is +undocumented and has no usage in modern perl versions on CPAN Grep. Calling it +has been fatal since 5.17.0. =back @@ -904,6 +904,16 @@ PERL_CALLCONV char* Perl_delimcpy(char* to, const char* toend, const char* from, assert(to); assert(toend); assert(from); assert(fromend); assert(retlen) PERL_CALLCONV void Perl_despatch_signals(pTHX); +PERL_CALLCONV_NO_RET OP* Perl_die(pTHX_ const char* pat, ...) + __attribute__noreturn__ + __attribute__format__null_ok__(__printf__,pTHX_1,pTHX_2); + +PERL_CALLCONV_NO_RET OP* Perl_die_sv(pTHX_ SV *baseex) + __attribute__noreturn__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_DIE_SV \ + assert(baseex) + PERL_CALLCONV_NO_RET void Perl_die_unwind(pTHX_ SV* msv) __attribute__noreturn__ __attribute__nonnull__(pTHX_1); @@ -5232,16 +5242,6 @@ PERL_CALLCONV void* Perl_my_cxt_init(pTHX_ int *index, size_t size) #endif #if !(defined(_MSC_VER)) -PERL_CALLCONV_NO_RET OP* Perl_die(pTHX_ const char* pat, ...) - __attribute__noreturn__ - __attribute__format__null_ok__(__printf__,pTHX_1,pTHX_2); - -PERL_CALLCONV_NO_RET OP* Perl_die_sv(pTHX_ SV *baseex) - __attribute__noreturn__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_DIE_SV \ - assert(baseex) - PERL_CALLCONV_NO_RET int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg) __attribute__noreturn__ __attribute__nonnull__(pTHX_1) @@ -5249,20 +5249,6 @@ PERL_CALLCONV_NO_RET int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg) #define PERL_ARGS_ASSERT_MAGIC_REGDATUM_SET \ assert(sv); assert(mg) -PERL_CALLCONV_NO_RET char* Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift, I32 *old_posp, I32 last) - __attribute__noreturn__ - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_5); -#define PERL_ARGS_ASSERT_SCREAMINSTR \ - assert(bigstr); assert(littlestr); assert(old_posp) - -# if defined(PERL_IMPLICIT_CONTEXT) -PERL_CALLCONV_NO_RET OP* Perl_die_nocontext(const char* pat, ...) - __attribute__noreturn__ - __attribute__format__null_ok__(__printf__,1,2); - -# endif #endif #if !defined(HAS_BZERO) && !defined(HAS_MEMSET) PERL_CALLCONV char* Perl_my_bzero(char* loc, I32 len) @@ -5765,6 +5751,10 @@ PERL_CALLCONV void Perl_deb_nocontext(const char* pat, ...) #define PERL_ARGS_ASSERT_DEB_NOCONTEXT \ assert(pat) +PERL_CALLCONV_NO_RET OP* Perl_die_nocontext(const char* pat, ...) + __attribute__noreturn__ + __attribute__format__null_ok__(__printf__,1,2); + PERL_CALLCONV char* Perl_form_nocontext(const char* pat, ...) __attribute__format__(__printf__,1,2) __attribute__nonnull__(1); @@ -5841,11 +5831,6 @@ PERL_CALLCONV void Perl_warner_nocontext(U32 err, const char* pat, ...) #define PERL_ARGS_ASSERT_WARNER_NOCONTEXT \ assert(pat) -# if defined(_MSC_VER) -PERL_CALLCONV OP* Perl_die_nocontext(const char* pat, ...) - __attribute__format__null_ok__(__printf__,1,2); - -# endif #endif #if defined(PERL_IMPLICIT_SYS) PERL_CALLCONV PerlInterpreter* perl_alloc_using(struct IPerlMem *ipM, struct IPerlMem *ipMS, struct IPerlMem *ipMP, struct IPerlEnv *ipE, struct IPerlStdIO *ipStd, struct IPerlLIO *ipLIO, struct IPerlDir *ipD, struct IPerlSock *ipS, struct IPerlProc *ipP) @@ -8205,27 +8190,12 @@ PERL_CALLCONV int Perl_do_spawn_nowait(pTHX_ char* cmd) #endif #if defined(_MSC_VER) -PERL_CALLCONV OP* Perl_die(pTHX_ const char* pat, ...) - __attribute__format__null_ok__(__printf__,pTHX_1,pTHX_2); - -PERL_CALLCONV OP* Perl_die_sv(pTHX_ SV *baseex) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_DIE_SV \ - assert(baseex) - PERL_CALLCONV int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_MAGIC_REGDATUM_SET \ assert(sv); assert(mg) -PERL_CALLCONV char* Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift, I32 *old_posp, I32 last) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_5); -#define PERL_ARGS_ASSERT_SCREAMINSTR \ - assert(bigstr); assert(littlestr); assert(old_posp) - #endif #ifdef PERL_CORE # include "pp_proto.h" @@ -917,23 +917,6 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U } } -char * -Perl_screaminstr(pTHX_ SV *bigstr, SV *littlestr, I32 start_shift, I32 end_shift, I32 *old_posp, I32 last) -{ - PERL_ARGS_ASSERT_SCREAMINSTR; - PERL_UNUSED_ARG(bigstr); - PERL_UNUSED_ARG(littlestr); - PERL_UNUSED_ARG(start_shift); - PERL_UNUSED_ARG(end_shift); - PERL_UNUSED_ARG(old_posp); - PERL_UNUSED_ARG(last); - - /* This function must only ever be called on a scalar with study magic, - but those do not happen any more. */ - Perl_croak(aTHX_ "panic: screaminstr"); - NORETURN_FUNCTION_END; -} - /* =for apidoc foldEQ @@ -1565,6 +1548,13 @@ The function never actually returns. =cut */ +#ifdef _MSC_VER +# pragma warning( push ) +# pragma warning( disable : 4646 ) /* warning C4646: function declared with + __declspec(noreturn) has non-void return type */ +# pragma warning( disable : 4645 ) /* warning C4645: function declared with +__declspec(noreturn) has a return statement */ +#endif OP * Perl_die_sv(pTHX_ SV *baseex) { @@ -1573,6 +1563,9 @@ Perl_die_sv(pTHX_ SV *baseex) assert(0); /* NOTREACHED */ NORETURN_FUNCTION_END; } +#ifdef _MSC_VER +# pragma warning( pop ) +#endif /* =for apidoc Am|OP *|die|const char *pat|... @@ -1585,6 +1578,13 @@ The function never actually returns. */ #if defined(PERL_IMPLICIT_CONTEXT) +#ifdef _MSC_VER +# pragma warning( push ) +# pragma warning( disable : 4646 ) /* warning C4646: function declared with + __declspec(noreturn) has non-void return type */ +# pragma warning( disable : 4645 ) /* warning C4645: function declared with +__declspec(noreturn) has a return statement */ +#endif OP * Perl_die_nocontext(const char* pat, ...) { @@ -1596,8 +1596,18 @@ Perl_die_nocontext(const char* pat, ...) va_end(args); NORETURN_FUNCTION_END; } +#ifdef _MSC_VER +# pragma warning( pop ) +#endif #endif /* PERL_IMPLICIT_CONTEXT */ +#ifdef _MSC_VER +# pragma warning( push ) +# pragma warning( disable : 4646 ) /* warning C4646: function declared with + __declspec(noreturn) has non-void return type */ +# pragma warning( disable : 4645 ) /* warning C4645: function declared with +__declspec(noreturn) has a return statement */ +#endif OP * Perl_die(pTHX_ const char* pat, ...) { @@ -1608,6 +1618,9 @@ Perl_die(pTHX_ const char* pat, ...) va_end(args); NORETURN_FUNCTION_END; } +#ifdef _MSC_VER +# pragma warning( pop ) +#endif /* =for apidoc Am|void|croak_sv|SV *baseex |