From: Marcus Holland-Moritz Date: Sat, 22 Oct 2005 13:02:02 +0000 (+0000) Subject: Turn NN to NULLOK for functions that have code to handle X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6472dca1ce130971bdb208d64ccb9758afc367d0;p=p5sagit%2Fp5-mst-13.2.git Turn NN to NULLOK for functions that have code to handle the ptr == NULL case and are currently called with NULL pointers. Having parameters tagged NN can make gcc optimize away the code for the NULL case, causing segfaults. p4raw-id: //depot/perl@25822 --- diff --git a/embed.fnc b/embed.fnc index 6491bce..320c638 100644 --- a/embed.fnc +++ b/embed.fnc @@ -113,7 +113,7 @@ Apd |void |av_undef |NULLOK AV* ar Apd |void |av_unshift |NULLOK AV* ar|I32 num Apo |SV** |av_arylen_p |NN AV* av pR |OP* |bind_match |I32 type|NN OP* left|NN OP* pat -pR |OP* |block_end |I32 floor|NN OP* seq +pR |OP* |block_end |I32 floor|NULLOK OP* seq ApR |I32 |block_gimme pR |int |block_start |int full p |void |boot_core_UNIVERSAL @@ -175,7 +175,7 @@ p |void |deprecate |NN const char* s p |void |deprecate_old |NN const char* s Afp |OP* |die |NULLOK const char* pat|... p |OP* |vdie |NULLOK const char* pat|NULLOK va_list* args -p |OP* |die_where |NN const char* message|STRLEN msglen +p |OP* |die_where |NULLOK const char* message|STRLEN msglen Ap |void |dounwind |I32 cxix p |bool |do_aexec |NULLOK SV* really|NN SV** mark|NN SV** sp p |bool |do_aexec5 |NULLOK SV* really|NN SV** mark|NN SV** sp|int fd|int flag @@ -563,7 +563,7 @@ p |PerlIO*|nextargv |NN GV* gv ApP |char* |ninstr |NN const char* big|NN const char* bigend \ |NN const char* little|NN const char* lend pr |OP* |oopsCV |NN OP* o -Ap |void |op_free |NN OP* arg +Ap |void |op_free |NULLOK OP* arg p |void |package |NN OP* o pd |PADOFFSET|pad_alloc |I32 optype|U32 tmptype p |PADOFFSET|allocmy |NN char* name @@ -724,7 +724,7 @@ Apd |CV* |sv_2cv |NULLOK SV* sv|NN HV** st|NN GV** gvp|I32 lref Apd |IO* |sv_2io |NN SV* sv Amb |IV |sv_2iv |NN SV* sv Apd |IV |sv_2iv_flags |NN SV* sv|I32 flags -Apd |SV* |sv_2mortal |NN SV* sv +Apd |SV* |sv_2mortal |NULLOK SV* sv Apd |NV |sv_2nv |NN SV* sv Amb |char* |sv_2pv |NN SV* sv|NULLOK STRLEN* lp Apd |char* |sv_2pv_flags |NN SV* sv|NULLOK STRLEN* lp|I32 flags @@ -1304,7 +1304,7 @@ sR |char* |swallow_bom |NN U8 *s s |void |checkcomma |NN char *s|NN const char *name|NN const char *what s |void |force_ident |NN const char *s|int kind s |void |incline |NN char *s -s |int |intuit_method |NN char *s|NN GV *gv +s |int |intuit_method |NN char *s|NULLOK GV *gv s |int |intuit_more |NN char *s s |I32 |lop |I32 f|int x|NN char *s rs |void |missingterm |NULLOK char *s diff --git a/proto.h b/proto.h index 416e1c4..2b028a1 100644 --- a/proto.h +++ b/proto.h @@ -171,8 +171,7 @@ PERL_CALLCONV OP* Perl_bind_match(pTHX_ I32 type, OP* left, OP* pat) __attribute__nonnull__(pTHX_3); PERL_CALLCONV OP* Perl_block_end(pTHX_ I32 floor, OP* seq) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_2); + __attribute__warn_unused_result__; PERL_CALLCONV I32 Perl_block_gimme(pTHX) __attribute__warn_unused_result__; @@ -364,9 +363,7 @@ PERL_CALLCONV OP* Perl_die(pTHX_ const char* pat, ...) __attribute__format__(__printf__,pTHX_1,pTHX_2); PERL_CALLCONV OP* Perl_vdie(pTHX_ const char* pat, va_list* args); -PERL_CALLCONV OP* Perl_die_where(pTHX_ const char* message, STRLEN msglen) - __attribute__nonnull__(pTHX_1); - +PERL_CALLCONV OP* Perl_die_where(pTHX_ const char* message, STRLEN msglen); PERL_CALLCONV void Perl_dounwind(pTHX_ I32 cxix); PERL_CALLCONV bool Perl_do_aexec(pTHX_ SV* really, SV** mark, SV** sp) __attribute__nonnull__(pTHX_2) @@ -1617,9 +1614,7 @@ PERL_CALLCONV OP* Perl_oopsCV(pTHX_ OP* o) __attribute__noreturn__ __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_op_free(pTHX_ OP* arg) - __attribute__nonnull__(pTHX_1); - +PERL_CALLCONV void Perl_op_free(pTHX_ OP* arg); PERL_CALLCONV void Perl_package(pTHX_ OP* o) __attribute__nonnull__(pTHX_1); @@ -2007,9 +2002,7 @@ PERL_CALLCONV IO* Perl_sv_2io(pTHX_ SV* sv) PERL_CALLCONV IV Perl_sv_2iv_flags(pTHX_ SV* sv, I32 flags) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV SV* Perl_sv_2mortal(pTHX_ SV* sv) - __attribute__nonnull__(pTHX_1); - +PERL_CALLCONV SV* Perl_sv_2mortal(pTHX_ SV* sv); PERL_CALLCONV NV Perl_sv_2nv(pTHX_ SV* sv) __attribute__nonnull__(pTHX_1); @@ -3660,8 +3653,7 @@ STATIC void S_incline(pTHX_ char *s) __attribute__nonnull__(pTHX_1); STATIC int S_intuit_method(pTHX_ char *s, GV *gv) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); + __attribute__nonnull__(pTHX_1); STATIC int S_intuit_more(pTHX_ char *s) __attribute__nonnull__(pTHX_1);