From: Jarkko Hietaniemi Date: Tue, 10 May 2005 19:44:00 +0000 (+0000) Subject: potential [PATCH] Tru64 crank up strictness X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24801a4b9a14a56208916a537c4c237993c25186;p=p5sagit%2Fp5-mst-13.2.git potential [PATCH] Tru64 crank up strictness Message-Id: <4ADE5AAD-27CB-4F9E-BEC7-41DAA7671108@iki.fi> p4raw-id: //depot/perl@24444 --- diff --git a/hints/dec_osf.sh b/hints/dec_osf.sh index bcefbe9..310486b 100644 --- a/hints/dec_osf.sh +++ b/hints/dec_osf.sh @@ -126,7 +126,7 @@ esac case "$isgcc" in gcc) ccflags="$ccflags -ansi" ;; -*) ccflags="$ccflags -std" +*) ccflags="$ccflags -std1" ;; esac @@ -259,7 +259,7 @@ case "`uname -r`" in esac # -msym: If using a sufficiently recent /sbin/loader, # keep the module symbols with the modules. - lddlflags="$lddlflags -msym -std" + lddlflags="$lddlflags -msym -std1" fi ;; esac @@ -413,7 +413,7 @@ TRY # Don't bother trying to work with Configure's idea of # cc and the various flags. This might not work as-is # with gcc -- but we're testing libc, not the compiler. - if cc -o try -std try.c && ./try + if cc -o try -std1 try.c && ./try then : ok else diff --git a/perl.h b/perl.h index c02f9a7..7f8654b 100644 --- a/perl.h +++ b/perl.h @@ -4993,6 +4993,10 @@ 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(). */ +#endif + /* and finally... */ #define PERL_PATCHLEVEL_H_IMPLICIT #include "patchlevel.h" diff --git a/toke.c b/toke.c index 2e1618e..6d1576b 100644 --- a/toke.c +++ b/toke.c @@ -107,6 +107,15 @@ static const char* const lex_state_names[] = { #endif #define CLINE (PL_copline = (CopLINE(PL_curcop) < PL_copline ? CopLINE(PL_curcop) : PL_copline)) +/* According to some strict interpretations of ANSI C89 one cannot + * cast void pointers to code pointers or vice versa (as filter_add(), + * filter_del(), and filter_read() will want to do). We should still + * be able to use a union for sneaky "casting". */ +typedef union { + XPVIO* iop; + filter_t filter; +} xpvio_filter_u; + /* * Convenience functions to return different tokens and prime the * lexer for the next token. They all take an argument. @@ -2128,6 +2137,8 @@ S_incl_perldb(pTHX) SV * Perl_filter_add(pTHX_ filter_t funcp, SV *datasv) { + xpvio_filter_u u; + if (!funcp) return Nullsv; @@ -2137,7 +2148,8 @@ Perl_filter_add(pTHX_ filter_t funcp, SV *datasv) datasv = NEWSV(255,0); if (!SvUPGRADE(datasv, SVt_PVIO)) Perl_die(aTHX_ "Can't upgrade filter_add data to SVt_PVIO"); - IoANY(datasv) = (void *)funcp; /* stash funcp into spare field */ + u.filter = funcp; + IoANY(datasv) = u.iop; /* stash funcp into spare field */ IoFLAGS(datasv) |= IOf_FAKE_DIRP; DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_add func %p (%s)\n", (void*)funcp, SvPV_nolen(datasv))); @@ -2152,12 +2164,15 @@ void Perl_filter_del(pTHX_ filter_t funcp) { SV *datasv; + xpvio_filter_u u; + DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_del func %p", (void*)funcp)); if (!PL_rsfp_filters || AvFILLp(PL_rsfp_filters)<0) return; /* if filter is on top of stack (usual case) just pop it off */ datasv = FILTER_DATA(AvFILLp(PL_rsfp_filters)); - if (IoANY(datasv) == (void *)funcp) { + u.iop = IoANY(datasv); + if (u.filter == funcp) { IoFLAGS(datasv) &= ~IOf_FAKE_DIRP; IoANY(datasv) = (void *)NULL; sv_free(av_pop(PL_rsfp_filters)); @@ -2176,6 +2191,7 @@ Perl_filter_read(pTHX_ int idx, SV *buf_sv, int maxlen) { filter_t funcp; SV *datasv = NULL; + xpvio_filter_u u; if (!PL_rsfp_filters) return -1; @@ -2217,7 +2233,8 @@ Perl_filter_read(pTHX_ int idx, SV *buf_sv, int maxlen) return FILTER_READ(idx+1, buf_sv, maxlen); /* recurse */ } /* Get function pointer hidden within datasv */ - funcp = (filter_t)IoANY(datasv); + u.iop = IoANY(datasv); + funcp = u.filter; DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_read %d: via function %p (%s)\n", idx, (void*)funcp, SvPV_nolen(datasv))); diff --git a/x2p/a2py.c b/x2p/a2py.c index 55c1303..efec1ef 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -56,6 +56,10 @@ usage() } #endif +#ifdef __osf__ +#pragma message disable (mainparm) /* We have the envp in main(). */ +#endif + int main(register int argc, register char **argv, register char **env) {