summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNiko Tyni <ntyni@debian.org>2009-04-14 22:55:34 +0300
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-04-16 23:18:46 +0200
commitc0cc52e96e988526754ef533bd76595720660db2 (patch)
treec4a4da2482d5c5991ac3a2a59bd374c95b92279e /t
parentc1a2df7619e7315b8fccef3b9fa56bb8d7df3845 (diff)
downloadperl-c0cc52e96e988526754ef533bd76595720660db2.tar.gz
Squelch 'Constant subroutine ... undefined' warnings from .ph files
As reported by Christopher Zimmermann in <http://bugs.debian.org/379757>, code generated from simple #undef directives by h2ph can cause 'Constant subroutine ... undefined' warnings if the undefined function was eligible for inlining.
Diffstat (limited to 't')
-rw-r--r--t/lib/h2ph.h4
-rw-r--r--t/lib/h2ph.pht4
2 files changed, 7 insertions, 1 deletions
diff --git a/t/lib/h2ph.h b/t/lib/h2ph.h
index 23f259e37e..78429ca310 100644
--- a/t/lib/h2ph.h
+++ b/t/lib/h2ph.h
@@ -26,6 +26,10 @@
#undef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+/* Test #undef'ining an existing constant function */
+#define NOTTRUE 0
+#undef NOTTRUE
+
/* Test #ifdef */
#ifdef __SOME_UNIMPORTANT_PROPERTY
#define MIN(a,b) ((a) < (b) ? (a) : (b))
diff --git a/t/lib/h2ph.pht b/t/lib/h2ph.pht
index 01db98d523..3723fca84a 100644
--- a/t/lib/h2ph.pht
+++ b/t/lib/h2ph.pht
@@ -1,6 +1,6 @@
require '_h2ph_pre.ph';
-no warnings 'redefine';
+no warnings qw(redefine misc);
unless(defined(&SQUARE)) {
sub SQUARE {
@@ -22,6 +22,8 @@ unless(defined(&_H2PH_H_)) {
my($a,$b) = @_;
eval q((($a) > ($b) ? ($a) : ($b)));
}' unless defined(&MAX);
+ eval 'sub NOTTRUE () {0;}' unless defined(&NOTTRUE);
+ undef(&NOTTRUE) if defined(&NOTTRUE);
if(defined(&__SOME_UNIMPORTANT_PROPERTY)) {
eval 'sub MIN {
my($a,$b) = @_;