This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make newCONSTSUB use the right warning scope.
authorFather Chrysostomos <sprout@cpan.org>
Mon, 21 Nov 2011 08:06:23 +0000 (00:06 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 21 Nov 2011 08:32:32 +0000 (00:32 -0800)
commit08f1b312e5e140a046594c5755039b96a41048ae
tree25cc26180d97dda7efaa761d3bdb19ea28ca8a94
parent799fd3b94fb5c431b24ee141e32a0b09d56f303c
Make newCONSTSUB use the right warning scope.

newCONSTSUB uses the compile-time warning hints, instead of the run-
time hints.  This means that

  use warnings;
  BEGIN {
    no warnings;
    some_XS_function_that_calls_new_CONSTSUB();
  }

may trigger a redefinition warning, whereas it should be analogous to

  use warnings;
  BEGIN {
    no warnings;
    *foo = \&bar;
  }

which does not warn.

newCONSTSUB localises PL_curcop and sets it to &PL_compiling.  When it
does that, it needs to copy the hints over.

Running tests inside eval is not reliable without a test count, so I
added one.
ext/XS-APItest/t/newCONSTSUB.t
op.c