From: Jarkko Hietaniemi Date: Mon, 30 May 2005 09:15:56 +0000 (+0300) Subject: Re: updated tru64 cc [PATCH]es (Re: [PATCH]es: Tru64/blead) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3c0f78ca4f737d7b40beecbfdca31b9f7e3fb952;p=p5sagit%2Fp5-mst-13.2.git Re: updated tru64 cc [PATCH]es (Re: [PATCH]es: Tru64/blead) Message-ID: <429AAF9C.30503@gmail.com> p4raw-id: //depot/perl@24627 --- diff --git a/embed.pl b/embed.pl index c917dfb..27815ae 100755 --- a/embed.pl +++ b/embed.pl @@ -794,10 +794,27 @@ EXTCONST void * const PL_force_link_funcs[] = { #define PERLVARIC(v,t,i) PERLVAR(v,t) #define PERLVARISC(v,i) PERLVAR(v,char) +/* In Tru64 (__DEC && __osf__) the cc option -std1 causes that one + * cannot cast between void pointers and function pointers without + * info level warnings. The PL_force_link_funcs[] would cause a few + * hundred of those warnings. In code one can circumnavigate this by using + * unions that overlay the different pointers, but in declarations one + * cannot use this trick. Therefore we just disable the warning here + * for the duration of the PL_force_link_funcs[] declaration. */ + +#if defined(__DECC) && defined(__osf__) +#pragma message save +#pragma message disable (nonstandcast) +#endif + #include "thrdvar.h" #include "intrpvar.h" #include "perlvars.h" +#if defined(__DECC) && defined(__osf__) +#pragma message restore +#endif + #undef PERLVAR #undef PERLVARA #undef PERLVARI diff --git a/ext/DynaLoader/dl_dlopen.xs b/ext/DynaLoader/dl_dlopen.xs index 66ee066..475112a 100644 --- a/ext/DynaLoader/dl_dlopen.xs +++ b/ext/DynaLoader/dl_dlopen.xs @@ -250,9 +250,16 @@ dl_install_xsub(perl_name, symref, filename="$Package") CODE: DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%lx)\n", perl_name, (unsigned long) symref)); +#if defined(__DECC) && defined(__osf__) +#pragma message save +#pragma message disable (nonstandcast) /* Avoid symref cast warning. */ +#endif ST(0) = sv_2mortal(newRV((SV*)newXS(perl_name, (void(*)(pTHX_ CV *))symref, filename))); +#if defined(__DECC) && defined(__osf__) +#pragma message restore +#endif char * diff --git a/perl.h b/perl.h index 3c17674..df12645 100644 --- a/perl.h +++ b/perl.h @@ -5093,8 +5093,8 @@ extern void moncontrol(int); * but also beware since this evaluates its argument twice, so no x++. */ #define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) -#ifdef __osf__ -#pragma message disable (mainparm) /* We have the envp in main(). */ +#if defined(__DECC) && defined(__osf__) +#pragma message disable (mainparm) /* Perl uses the envp in main(). */ #endif /* and finally... */ diff --git a/sv.c b/sv.c index 82664c0..9bd3ab1 100644 --- a/sv.c +++ b/sv.c @@ -11219,6 +11219,9 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param) void (*dptr) (void*); void (*dxptr) (pTHX_ void*); OP *o; + /* Unions for circumventing strict ANSI C89 casting rules. */ + union { void *vptr; void (*dptr)(void*); } u1, u2; + union { void *vptr; void (*dxptr)(pTHX_ void*); } u3, u4; Newz(54, nss, max, ANY); @@ -11390,13 +11393,17 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param) ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = any_dup(ptr, proto_perl); /* XXX quite arbitrary */ dptr = POPDPTR(ss,ix); - TOPDPTR(nss,ix) = (void (*)(void*))any_dup((void *)dptr, proto_perl); + u1.dptr = dptr; + u2.vptr = any_dup(u1.vptr, proto_perl); + TOPDPTR(nss,ix) = u2.dptr; break; case SAVEt_DESTRUCTOR_X: ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = any_dup(ptr, proto_perl); /* XXX quite arbitrary */ dxptr = POPDXPTR(ss,ix); - TOPDXPTR(nss,ix) = (void (*)(pTHX_ void*))any_dup((void *)dxptr, proto_perl); + u3.dxptr = dxptr; + u4.vptr = any_dup(u3.vptr, proto_perl);; + TOPDXPTR(nss,ix) = u4.dxptr; break; case SAVEt_REGCONTEXT: case SAVEt_ALLOC: