From 1448eab9dcf4738ba8e46bfbfee419adddd9b5a0 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 18 Nov 2020 17:15:38 -0800 Subject: [PATCH] clean up debug flags --- dev-bin/build.pl | 5 +++-- lib/Perl/Tidy/VerticalAligner.pm | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dev-bin/build.pl b/dev-bin/build.pl index 84299961..8ecab492 100755 --- a/dev-bin/build.pl +++ b/dev-bin/build.pl @@ -628,9 +628,10 @@ sub update_VERSION { my $is_pod_file = !$is_md_file && $source_file !~ /\.pm/; while ( my $line = <$fh> ) { - # Look for and turn off any DEVEL_MODE or DEBUG_XXX or VERIFY_XXX constants + # Look for and turn off any DEVEL_MODE, DEBUG_XXX, VERIFY_XXX, + # and EXPLAIN_XXX constants if ( $line =~ - /^(\s*use\s+constant\s+(?:DEBUG|DEVEL|VERIFY)_[A-Z]+\s*)=>\s*(-?\d*);(.*)$/ +/^(\s*use\s+constant\s+(?:DEBUG|DEVEL|EXPLAIN|VERIFY)_[A-Z]+\s*)=>\s*(-?\d*);(.*)$/ ) { if ( $2 != 0 ) { diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index a5b4dbf1..5ffae066 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -126,14 +126,14 @@ BEGIN { # produce a lot of output It should be 0 except when debugging small # scripts. - use constant VALIGN_DEBUG_FLAG_TABS => 0; + use constant DEBUG_TABS => 0; my $debug_warning = sub { print STDOUT "VALIGN_DEBUGGING with key $_[0]\n"; return; }; - VALIGN_DEBUG_FLAG_TABS && $debug_warning->('TABS'); + DEBUG_TABS && $debug_warning->('TABS'); } @@ -335,6 +335,8 @@ sub push_group_line { return; } +use constant DEBUG_VALIGN => 0; + sub valign_input { # Place one line in the current vertical group. @@ -456,7 +458,7 @@ sub valign_input { my $group_level = $self->[_group_level_]; - 0 && do { + DEBUG_VALIGN && do { my $nlines = $self->group_line_count(); print STDOUT "Entering valign_input: lines=$nlines new #fields= $jmax, leading_count=$leading_space_count force=$is_forced_break, level_jump=$level_jump, level=$level, group_level=$group_level, level_jump=$level_jump\n"; @@ -722,7 +724,7 @@ EOM # -------------------------------------------------------------------- # Some old debugging stuff # -------------------------------------------------------------------- - 0 && do { + DEBUG_VALIGN && do { print STDOUT "exiting valign_input fields:"; dump_array( @{$rfields} ); print STDOUT "exiting valign_input tokens:"; @@ -4542,7 +4544,7 @@ sub valign_output_step_D { # shouldn't happen - program error counting whitespace # - skip entabbing - VALIGN_DEBUG_FLAG_TABS + DEBUG_TABS && $self->warning( "Error entabbing in valign_output_step_D: expected count=$leading_space_count\n" ); @@ -4560,7 +4562,7 @@ sub valign_output_step_D { # But it could be an outdented comment if ( $line !~ /^\s*#/ ) { - VALIGN_DEBUG_FLAG_TABS + DEBUG_TABS && $self->warning( "Error entabbing in valign_output_step_D: for level=$level count=$leading_space_count\n" ); @@ -4577,7 +4579,7 @@ sub valign_output_step_D { # shouldn't happen - program error counting whitespace # we'll skip entabbing - VALIGN_DEBUG_FLAG_TABS + DEBUG_TABS && $self->warning( "Error entabbing in valign_output_step_D: expected count=$leading_space_count\n" ); @@ -4646,7 +4648,7 @@ sub valign_output_step_D { # shouldn't happen: if ( $space_count < 0 ) { - VALIGN_DEBUG_FLAG_TABS + DEBUG_TABS && $self->warning( "Error in get_leading_string: for level=$group_level count=$leading_whitespace_count\n" ); -- 2.39.5