From: Gurusamy Sarathy Date: Mon, 12 Jul 1999 06:14:54 +0000 (+0000) Subject: fixups for sundry warnings about function pointers X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b94c7bb9a33fcbef93724c1b5f96b2616e1e13f;p=p5sagit%2Fp5-mst-13.2.git fixups for sundry warnings about function pointers p4raw-id: //depot/perl@3669 --- diff --git a/ext/re/re.xs b/ext/re/re.xs index 98ffd74..04a5fdc 100644 --- a/ext/re/re.xs +++ b/ext/re/re.xs @@ -26,11 +26,11 @@ static void deinstall(pTHX) { dTHR; - PL_regexecp = FUNC_NAME_TO_PTR(Perl_regexec_flags); - PL_regcompp = FUNC_NAME_TO_PTR(Perl_pregcomp); - PL_regint_start = FUNC_NAME_TO_PTR(Perl_re_intuit_start); - PL_regint_string = FUNC_NAME_TO_PTR(Perl_re_intuit_string); - PL_regfree = FUNC_NAME_TO_PTR(Perl_pregfree); + PL_regexecp = Perl_regexec_flags; + PL_regcompp = Perl_pregcomp; + PL_regint_start = Perl_re_intuit_start; + PL_regint_string = Perl_re_intuit_string; + PL_regfree = Perl_pregfree; if (!oldfl) PL_debug &= ~R_DB; diff --git a/intrpvar.h b/intrpvar.h index 0b9dfa6..65ab5c6 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -226,7 +226,7 @@ PERLVAR(Ihe_root, HE *) /* free he list--shared by interpreters */ PERLVAR(Inice_chunk, char *) /* a nice chunk of memory to reuse */ PERLVAR(Inice_chunk_size, U32) /* how nice the chunk of memory is */ -PERLVARI(Irunops, runops_proc_t, FUNC_NAME_TO_PTR(RUNOPS_DEFAULT)) +PERLVARI(Irunops, runops_proc_t, MEMBER_TO_FPTR(RUNOPS_DEFAULT)) PERLVARA(Itokenbuf,256, char) diff --git a/op.c b/op.c index 858bf00..ae6297c 100644 --- a/op.c +++ b/op.c @@ -677,7 +677,7 @@ Perl_op_free(pTHX_ OP *o) #endif /* USE_THREADS */ default: if (!(o->op_flags & OPf_REF) - || (PL_check[o->op_type] != FUNC_NAME_TO_PTR(Perl_ck_ftst))) + || (PL_check[o->op_type] != MEMBER_TO_FPTR(Perl_ck_ftst))) break; /* FALL THROUGH */ case OP_GVSV: diff --git a/perl.c b/perl.c index bb3f2a9..8db7c21 100644 --- a/perl.c +++ b/perl.c @@ -110,7 +110,7 @@ perl_construct(pTHXx) thr = init_main_thread(); #endif /* USE_THREADS */ - PL_protect = FUNC_NAME_TO_PTR(Perl_default_protect); /* for exceptions */ + PL_protect = MEMBER_TO_FPTR(Perl_default_protect); /* for exceptions */ PL_curcop = &PL_compiling; /* needed by ckWARN, right away */ @@ -626,7 +626,7 @@ setuid perl scripts securely.\n"); oldscope = PL_scopestack_ix; PL_dowarn = G_WARN_OFF; - CALLPROTECT(aTHX_ &ret, FUNC_NAME_TO_PTR(S_parse_body), env, xsinit); + CALLPROTECT(aTHX_ &ret, MEMBER_TO_FPTR(S_parse_body), env, xsinit); switch (ret) { case 0: return 0; @@ -999,7 +999,7 @@ perl_run(pTHXx) oldscope = PL_scopestack_ix; redo_body: - CALLPROTECT(aTHX_ &ret, FUNC_NAME_TO_PTR(S_run_body), oldscope); + CALLPROTECT(aTHX_ &ret, MEMBER_TO_FPTR(S_run_body), oldscope); switch (ret) { case 1: cxstack_ix = -1; /* start context stack again */ @@ -1254,7 +1254,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags) PL_markstack_ptr++; redo_body: - CALLPROTECT(aTHX_ &ret, FUNC_NAME_TO_PTR(S_call_body), (OP*)&myop, FALSE); + CALLPROTECT(aTHX_ &ret, MEMBER_TO_FPTR(S_call_body), (OP*)&myop, FALSE); switch (ret) { case 0: retval = PL_stack_sp - (PL_stack_base + oldmark); @@ -1376,7 +1376,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags) myop.op_flags |= OPf_SPECIAL; redo_body: - CALLPROTECT(aTHX_ &ret, FUNC_NAME_TO_PTR(S_call_body), (OP*)&myop, TRUE); + CALLPROTECT(aTHX_ &ret, MEMBER_TO_FPTR(S_call_body), (OP*)&myop, TRUE); switch (ret) { case 0: retval = PL_stack_sp - (PL_stack_base + oldmark); @@ -2936,11 +2936,11 @@ S_init_main_thread(pTHX) (void) find_threadsv("@"); /* Ensure $@ is initialised early */ PL_maxscream = -1; - PL_regcompp = FUNC_NAME_TO_PTR(Perl_pregcomp); - PL_regexecp = FUNC_NAME_TO_PTR(Perl_regexec_flags); - PL_regint_start = FUNC_NAME_TO_PTR(Perl_re_intuit_start); - PL_regint_string = FUNC_NAME_TO_PTR(Perl_re_intuit_string); - PL_regfree = FUNC_NAME_TO_PTR(Perl_pregfree); + PL_regcompp = MEMBER_TO_FPTR(Perl_pregcomp); + PL_regexecp = MEMBER_TO_FPTR(Perl_regexec_flags); + PL_regint_start = MEMBER_TO_FPTR(Perl_re_intuit_start); + PL_regint_string = MEMBER_TO_FPTR(Perl_re_intuit_string); + PL_regfree = MEMBER_TO_FPTR(Perl_pregfree); PL_regindent = 0; PL_reginterp_cnt = 0; @@ -2961,7 +2961,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList) while (AvFILL(paramList) >= 0) { cv = (CV*)av_shift(paramList); SAVEFREESV(cv); - CALLPROTECT(aTHX_ &ret, FUNC_NAME_TO_PTR(S_call_list_body), cv); + CALLPROTECT(aTHX_ &ret, MEMBER_TO_FPTR(S_call_list_body), cv); switch (ret) { case 0: (void)SvPV(atsv, len); diff --git a/perl.h b/perl.h index 07dada4..b8f9ae6 100644 --- a/perl.h +++ b/perl.h @@ -1494,10 +1494,6 @@ typedef union any ANY; # endif #endif -#ifndef FUNC_NAME_TO_PTR -#define FUNC_NAME_TO_PTR(name) name -#endif - /* * USE_THREADS needs to be after unixish.h as includes * which defines NSIG - which will stop inclusion of @@ -1593,6 +1589,10 @@ typedef pthread_key_t perl_key; # define STATUS_ALL_FAILURE (PL_statusvalue = 1) #endif +#ifndef MEMBER_TO_FPTR +#define MEMBER_TO_FPTR(name) name +#endif + /* This defines a way to flush all output buffers. This may be a * performance issue, so we allow people to disable it. * XXX the default needs a Configure test, as it may not work everywhere. diff --git a/pp_ctl.c b/pp_ctl.c index d7fec16..77a4849 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -870,7 +870,7 @@ PP(pp_sort) (void)SvREFCNT_inc(cv); /* in preparation for POPSUB */ } PL_sortcxix = cxstack_ix; - qsortsv((myorigmark+1), max, FUNC_NAME_TO_PTR(sortcv)); + qsortsv((myorigmark+1), max, sortcv); POPBLOCK(cx,PL_curpm); PL_stack_sp = newsp; @@ -884,19 +884,13 @@ PP(pp_sort) qsortsv(ORIGMARK+1, max, (PL_op->op_private & OPpSORT_NUMERIC) ? ( (PL_op->op_private & OPpSORT_INTEGER) - ? ( overloading - ? FUNC_NAME_TO_PTR(amagic_i_ncmp) - : FUNC_NAME_TO_PTR(sv_i_ncmp)) - : ( overloading - ? FUNC_NAME_TO_PTR(amagic_ncmp) - : FUNC_NAME_TO_PTR(sv_ncmp))) + ? ( overloading ? amagic_i_ncmp : sv_i_ncmp) + : ( overloading ? amagic_ncmp : sv_ncmp)) : ( (PL_op->op_private & OPpLOCALE) ? ( overloading - ? FUNC_NAME_TO_PTR(amagic_cmp_locale) - : FUNC_NAME_TO_PTR(sv_cmp_locale_static)) - : ( overloading - ? FUNC_NAME_TO_PTR(amagic_cmp) - : FUNC_NAME_TO_PTR(sv_cmp_static) ))); + ? amagic_cmp_locale + : sv_cmp_locale_static) + : ( overloading ? amagic_cmp : sv_cmp_static))); if (PL_op->op_private & OPpSORT_REVERSE) { SV **p = ORIGMARK+1; SV **q = ORIGMARK+max; @@ -2427,7 +2421,7 @@ S_docatch(pTHX_ OP *o) #endif PL_op = o; redo_body: - CALLPROTECT(aTHX_ &ret, FUNC_NAME_TO_PTR(S_docatch_body)); + CALLPROTECT(aTHX_ &ret, MEMBER_TO_FPTR(S_docatch_body)); switch (ret) { case 0: break; diff --git a/scope.h b/scope.h index 4a3a2ed..efaf589 100644 --- a/scope.h +++ b/scope.h @@ -83,8 +83,7 @@ save_delete(SOFT_CAST(HV*)(h), SOFT_CAST(char*)(k), (I32)(l)) #define CALLDESTRUCTOR (*SSPOPDPTR) #define SAVEDESTRUCTOR(f,p) \ - save_destructor((DESTRUCTORFUNC_t)(FUNC_NAME_TO_PTR(f)), \ - SOFT_CAST(void*)(p)) + save_destructor((DESTRUCTORFUNC_t)(f), SOFT_CAST(void*)(p)) #define SAVESTACK_POS() \ STMT_START { \ diff --git a/sv.c b/sv.c index 6392f54..5b5a361 100644 --- a/sv.c +++ b/sv.c @@ -294,17 +294,17 @@ S_visit(pTHX_ SVFUNC_t f) void Perl_sv_report_used(pTHX) { - visit(FUNC_NAME_TO_PTR(do_report_used)); + visit(do_report_used); } void Perl_sv_clean_objs(pTHX) { PL_in_clean_objs = TRUE; - visit(FUNC_NAME_TO_PTR(do_clean_objs)); + visit(do_clean_objs); #ifndef DISABLE_DESTRUCTOR_KLUDGE /* some barnacles may yet remain, clinging to typeglobs */ - visit(FUNC_NAME_TO_PTR(do_clean_named_objs)); + visit(do_clean_named_objs); #endif PL_in_clean_objs = FALSE; } @@ -313,7 +313,7 @@ void Perl_sv_clean_all(pTHX) { PL_in_clean_all = TRUE; - visit(FUNC_NAME_TO_PTR(do_clean_all)); + visit(do_clean_all); PL_in_clean_all = FALSE; } diff --git a/thrdvar.h b/thrdvar.h index b3f3be5..f4d3ed4 100644 --- a/thrdvar.h +++ b/thrdvar.h @@ -100,7 +100,7 @@ PERLVAR(Tmainstack, AV *) /* the stack when nothing funny is happening */ PERLVAR(Ttop_env, JMPENV *) /* ptr. to current sigjmp() environment */ PERLVAR(Tstart_env, JMPENV) /* empty startup sigjmp() environment */ -PERLVARI(Tprotect, protect_proc_t, FUNC_NAME_TO_PTR(Perl_default_protect)) +PERLVARI(Tprotect, protect_proc_t, MEMBER_TO_FPTR(Perl_default_protect)) /* statics "owned" by various functions */ PERLVAR(Tav_fetch_sv, SV *) /* owned by av_fetch() */ @@ -173,15 +173,15 @@ PERLVARI(Treg_curpm, PMOP*, NULL) /* curpm during match */ PERLVAR(Treg_oldsaved, char*) /* old saved substr during match */ PERLVAR(Treg_oldsavedlen, STRLEN) /* old length of saved substr during match */ -PERLVARI(Tregcompp, regcomp_t, FUNC_NAME_TO_PTR(Perl_pregcomp)) +PERLVARI(Tregcompp, regcomp_t, MEMBER_TO_FPTR(Perl_pregcomp)) /* Pointer to REx compiler */ -PERLVARI(Tregexecp, regexec_t, FUNC_NAME_TO_PTR(Perl_regexec_flags)) +PERLVARI(Tregexecp, regexec_t, MEMBER_TO_FPTR(Perl_regexec_flags)) /* Pointer to REx executer */ -PERLVARI(Tregint_start, re_intuit_start_t, FUNC_NAME_TO_PTR(Perl_re_intuit_start)) +PERLVARI(Tregint_start, re_intuit_start_t, MEMBER_TO_FPTR(Perl_re_intuit_start)) /* Pointer to optimized REx executer */ -PERLVARI(Tregint_string,re_intuit_string_t, FUNC_NAME_TO_PTR(Perl_re_intuit_string)) +PERLVARI(Tregint_string,re_intuit_string_t, MEMBER_TO_FPTR(Perl_re_intuit_string)) /* Pointer to optimized REx string */ -PERLVARI(Tregfree, regfree_t, FUNC_NAME_TO_PTR(Perl_pregfree)) +PERLVARI(Tregfree, regfree_t, MEMBER_TO_FPTR(Perl_pregfree)) /* Pointer to REx free()er */ PERLVARI(Treginterp_cnt,int, 0) /* Whether `Regexp' diff --git a/util.c b/util.c index 960bdb5..1ed48d2 100644 --- a/util.c +++ b/util.c @@ -3233,7 +3233,7 @@ Perl_new_struct_thread(pTHX_ struct perl_thread *t) Zero(thr, 1, struct perl_thread); #endif - PL_protect = FUNC_NAME_TO_PTR(Perl_default_protect); + PL_protect = MEMBER_TO_FPTR(Perl_default_protect); thr->oursv = sv; init_stacks(); @@ -3266,11 +3266,11 @@ Perl_new_struct_thread(pTHX_ struct perl_thread *t) PL_statname = NEWSV(66,0); PL_maxscream = -1; - PL_regcompp = FUNC_NAME_TO_PTR(Perl_pregcomp); - PL_regexecp = FUNC_NAME_TO_PTR(Perl_regexec_flags); - PL_regint_start = FUNC_NAME_TO_PTR(Perl_re_intuit_start); - PL_regint_string = FUNC_NAME_TO_PTR(Perl_re_intuit_string); - PL_regfree = FUNC_NAME_TO_PTR(Perl_pregfree); + PL_regcompp = MEMBER_TO_FPTR(Perl_pregcomp); + PL_regexecp = MEMBER_TO_FPTR(Perl_regexec_flags); + PL_regint_start = MEMBER_TO_FPTR(Perl_re_intuit_start); + PL_regint_string = MEMBER_TO_FPTR(Perl_re_intuit_string); + PL_regfree = MEMBER_TO_FPTR(Perl_pregfree); PL_regindent = 0; PL_reginterp_cnt = 0; PL_lastscream = Nullsv; diff --git a/win32/Makefile b/win32/Makefile index 3139be6..82a72ec 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -138,10 +138,7 @@ CCLIBDIR = $(CCHOME)\lib # We don't enable this by default because we want the modules to get fixed # instead of clinging to shortcuts like this one. # -# Don't enable -DPERL_IMPLICIT_CONTEXT if you don't know what it is. :-) -# #BUILDOPT = $(BUILDOPT) -DPERL_POLLUTE -#BUILDOPT = $(BUILDOPT) -DPERL_IMPLICIT_CONTEXT # # specify semicolon-separated list of extra directories that modules will @@ -186,6 +183,10 @@ USE_THREADS = undef USE_MULTI = undef !ENDIF +!IF "$(USE_MULTI)$(USE_THREADS)$(USE_OBJECT)" != "" +BUILDOPT = $(BUILDOPT) -DPERL_IMPLICIT_CONTEXT +!ENDIF + !IF "$(PROCESSOR_ARCHITECTURE)" == "" PROCESSOR_ARCHITECTURE = x86 !ENDIF diff --git a/win32/makefile.mk b/win32/makefile.mk index 2289b91..ffda9fd 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -153,10 +153,7 @@ CCLIBDIR *= $(CCHOME)\lib # We don't enable this by default because we want the modules to get fixed # instead of clinging to shortcuts like this one. # -# Don't enable -DPERL_IMPLICIT_CONTEXT if you don't know what it is. :-) -# #BUILDOPT += -DPERL_POLLUTE -#BUILDOPT += -DPERL_IMPLICIT_CONTEXT # # specify semicolon-separated list of extra directories that modules will @@ -174,7 +171,7 @@ EXTRALIBDIRS *= # set this to your email address (perl will guess a value from # from your loginname and your hostname, which may not be right) # -EMAIL *= support@activestate.com +#EMAIL *= ## ## Build configuration ends. @@ -200,6 +197,12 @@ PERL_MALLOC *= undef USE_THREADS *= undef USE_MULTI *= undef + +.IF "$(USE_MULTI)$(USE_THREADS)$(USE_OBJECT)" != "" +BUILDOPT += -DPERL_IMPLICIT_CONTEXT +.ENDIF + + .IMPORT .IGNORE : PROCESSOR_ARCHITECTURE PROCESSOR_ARCHITECTURE *= x86 @@ -639,12 +642,7 @@ X2P_OBJ = $(X2P_SRC:db:+$(o)) PERLDLL_OBJ = $(CORE_OBJ) PERLEXE_OBJ = perlmain$(o) -.IF "$(USE_OBJECT)" != "define" PERLDLL_OBJ += $(WIN32_OBJ) $(DLL_OBJ) -.ELSE -PERLEXE_OBJ += $(WIN32_OBJ) $(DLL_OBJ) -PERL95_OBJ += DynaLoadmt$(o) -.ENDIF .IF "$(USE_SETARGV)" != "" SETARGV_OBJ = setargv$(o) diff --git a/win32/win32.c b/win32/win32.c index a011573..59e493a 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -66,6 +66,11 @@ int _CRT_glob = 0; #endif +#ifdef __BORLANDC__ +# define _stat stat +# define _utimbuf utimbuf +#endif + #define EXECF_EXEC 1 #define EXECF_SPAWN 2 #define EXECF_SPAWN_NOWAIT 3 @@ -1551,9 +1556,9 @@ extern char * des_fcrypt(const char *txt, const char *salt, char *cbuf); DllExport char * win32_crypt(const char *txt, const char *salt) { + dTHXo; #ifdef HAVE_DES_FCRYPT dTHR; - dTHXo; return des_fcrypt(txt, salt, crypt_buffer); #else die("The crypt() function is unimplemented due to excessive paranoia."); diff --git a/win32/win32.h b/win32/win32.h index 1110f7e..0ed53d6 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -182,7 +182,7 @@ struct utsname { /* Borland is picky about a bare member function name used as its ptr */ #ifdef PERL_OBJECT -#define FUNC_NAME_TO_PTR(name) &(name) +# define MEMBER_TO_FPTR(name) &(name) #endif #endif @@ -256,7 +256,7 @@ typedef long gid_t; #define fcloseall _fcloseall #ifdef PERL_OBJECT -#define FUNC_NAME_TO_PTR(name) &(name) +# define MEMBER_TO_FPTR(name) &(name) #endif #ifndef _O_NOINHERIT