X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=warnings.pl;h=97d5d14bab4d3c3ab324dd46778721a2ff40711f;hb=b3c649451aa23903a1f1aa5b0d54e8244611b239;hp=94cc34fbf6b68a1f8b8b7b647285daa762775136;hpb=dbab294c68e8160ef916906a4beca1da8c0c2ec5;p=p5sagit%2Fp5-mst-13.2.git diff --git a/warnings.pl b/warnings.pl index 94cc34f..97d5d14 100644 --- a/warnings.pl +++ b/warnings.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -$VERSION = '1.02_01'; +$VERSION = '1.02_02'; BEGIN { push @INC, './lib'; @@ -61,7 +61,7 @@ my $tree = { 'pack' => [ 5.008, DEFAULT_OFF], 'unpack' => [ 5.008, DEFAULT_OFF], 'threads' => [ 5.008, DEFAULT_OFF], - 'assertions' => [ 5.009, DEFAULT_OFF], + 'imprecision' => [ 5.011, DEFAULT_OFF], #'default' => [ 5.008, DEFAULT_ON ], }], @@ -276,12 +276,15 @@ print WARN <<'EOM' ; #define G_WARN_ONCE 8 /* set if 'once' ever enabled */ #define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF) -#define pWARN_STD Nullsv -#define pWARN_ALL (Nullsv+1) /* use warnings 'all' */ -#define pWARN_NONE (Nullsv+2) /* no warnings 'all' */ +#define pWARN_STD NULL +#define pWARN_ALL (((STRLEN*)0)+1) /* use warnings 'all' */ +#define pWARN_NONE (((STRLEN*)0)+2) /* no warnings 'all' */ #define specialWARN(x) ((x) == pWARN_STD || (x) == pWARN_ALL || \ (x) == pWARN_NONE) + +/* if PL_warnhook is set to this value, then warnings die */ +#define PERL_WARNHOOK_FATAL (&PL_sv_placeholder) EOM my $offset = 0 ; @@ -316,17 +319,19 @@ print WARN tab(5, '#define WARNsize'), "$warn_size\n" ; #print WARN tab(5, '#define WARN_ALLstring'), '"', ('\377' x $warn_size) , "\"\n" ; print WARN tab(5, '#define WARN_ALLstring'), '"', ('\125' x $warn_size) , "\"\n" ; print WARN tab(5, '#define WARN_NONEstring'), '"', ('\0' x $warn_size) , "\"\n" ; -my $WARN_TAINTstring = mkOct($warn_size, map $_ * 2, @{ $list{'taint'} }); - -print WARN tab(5, '#define WARN_TAINTstring'), qq["$WARN_TAINTstring"\n] ; print WARN <<'EOM'; #define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD) #define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD) #define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE)) -#define isWARN_on(c,x) (IsSet(SvPVX_const(c), 2*(x))) -#define isWARNf_on(c,x) (IsSet(SvPVX_const(c), 2*(x)+1)) +#define isWARN_on(c,x) (IsSet((U8 *)(c + 1), 2*(x))) +#define isWARNf_on(c,x) (IsSet((U8 *)(c + 1), 2*(x)+1)) + +#define DUP_WARNINGS(p) \ + (specialWARN(p) ? (STRLEN*)(p) \ + : (STRLEN*)CopyD(p, PerlMemShared_malloc(sizeof(*p)+*p), sizeof(*p)+*p, \ + char)) #define ckWARN(w) Perl_ckwarn(aTHX_ packWARN(w)) #define ckWARN2(w1,w2) Perl_ckwarn(aTHX_ packWARN2(w1,w2)) @@ -432,7 +437,14 @@ __END__ package warnings; -our $VERSION = '1.04'; +our $VERSION = '1.06'; + +# Verify that we're called correctly so that warnings will work. +# see also strict.pm. +unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) { + my (undef, $f, $l) = caller; + die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n"); +} =head1 NAME