Revision: 937
Author: tim.bunce
Date: Tue Dec 8 08:02:24 2009
Log: Fixed dumb attempt to enable assertions.
Added Makefile.PL option to enable 'hard' (non croak-if-PL_debug)
assertions.
Default the option true if $ENV{AUTOMATED_TESTING} is true.
Default the option true for developers (use --noassert to disable).
http://code.google.com/p/perl-devel-nytprof/source/detail?r=937
Modified:
/trunk/Makefile.PL
/trunk/NYTProf.xs
=======================================
--- /trunk/Makefile.PL Mon Nov 16 06:27:29 2009
+++ /trunk/Makefile.PL Tue Dec 8 08:02:24 2009
@@ -20,7 +20,7 @@
my $is_developer = (-d '.svn');
-# This lets me build it under ext/Devel, and profile parts of the core in
place
+# This lets perl developers build under ext/Devel, and profile parts of
the core in place
unless($ENV{PERL_CORE}) {
$ENV{PERL_CORE} = 1 if grep { $_ eq 'PERL_CORE=1' } @ARGV;
}
@@ -37,10 +37,15 @@
# --- Options
GetOptions(
- 'g!' => \my $opt_g,
- 'pg!' => \my $opt_pg,
+ 'g!' => \my $opt_g, # compile with -g (for debugging)
+ 'assert!' => \my $opt_assert, # enable assert()ions in the code (and
perl headers)
+ 'pg!' => \my $opt_pg, # compile with -pg (for profiling
NYTProf itself)
) or exit 1;
+if (not defined $opt_assert) {
+ $opt_assert = 1 if $opt_g;
+ $opt_assert = 1 if $ENV{AUTOMATED_TESTING}; # enable assert()s for
cpan-testers
+}
# --- make sure t/test40pmc.pmc is newer than t/test40pmc.pmc
@@ -82,6 +87,10 @@
$mm_opts{DEFINE} .= " $define";
}
}
+if ($opt_assert or (not defined $opt_assert and $is_developer)) {
+ warn "Assertion testing enabled\n";
+ $mm_opts{DEFINE} .= " -DUSE_HARD_ASSERT";
+}
$mm_opts{LICENSE} = 'perl' if $ExtUtils::MakeMaker::VERSION >= 6.3002;
$mm_opts{OPTIMIZE} = '-g' if $opt_g;
=======================================
--- /trunk/NYTProf.xs Mon Dec 7 14:37:56 2009
+++ /trunk/NYTProf.xs Tue Dec 8 08:02:24 2009
@@ -27,6 +27,11 @@
# include "ppport.h"
#endif
+#ifdef USE_HARD_ASSERT
+#undef NDEBUG
+#include <assert.h>
+#endif
+
#if !defined(OutCopFILE)
# define OutCopFILE CopFILE
#endif
@@ -87,8 +92,6 @@
#define ZLIB_VERSION "0"
#endif
-#define NDEBUG /* enable assertions */
-
#define NYTP_FILE_MAJOR_VERSION 3
#define NYTP_FILE_MINOR_VERSION 0
--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.
Group hosted at: http://groups.google.com/group/develnytprof-dev
Project hosted at: http://perl-devel-nytprof.googlecode.com
CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf
To post, email: [email protected]
To unsubscribe, email: [email protected]