perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@p6m7g8.com>
Subject Re: -Wdeclaration-after-statement Final version
Date Sun, 21 Aug 2005 05:06:46 GMT
Philippe M. Chiasson wrote:
> A better patch might be to first check if we already have that option from Perl,
> otherwise, try and figure out if it's safe to add it ourselves.
Okay, as requested, I've functionalized this and added a check to make sure
$ccopts doesn't already contain this compile flag.

Index: lib/Apache2/Build.pm
===================================================================
--- lib/Apache2/Build.pm        (revision 234145)
+++ lib/Apache2/Build.pm        (working copy)
@@ -523,6 +523,11 @@
              $ccopts .= " $Wall -DAP_DEBUG";
              $ccopts .= " -DAP_HAVE_DESIGNATED_INITIALIZER";
          }
+
+        if ($self->has_gcc_version('3.3.2') &&
+            $ccopts !~ /declaration-after-statement/) {
+            $ccopts .= " -Wdeclaration-after-statement";
+        }
      }

      if ($self->{MP_COMPAT_1X}) {
@@ -555,6 +560,28 @@
      $ccopts;
  }

+sub has_gcc_version {
+
+    my $self = shift;
+    my $requested_version = shift;
+
+    my $has_version = $self->perl_config('gccversion');
+
+    return 0 unless $has_version;
+
+    my ($has_major, $has_minor, $has_patch) = split /\./, $has_version, 3;
+    my ($r_major, $r_minor, $r_patch) = split /\./, $requested_version, 3;
+
+    if ($has_major > $r_major ||
+        ($has_major == $r_major && $has_minor > $r_minor) ||
+        ($has_major == $r_major && $has_minor == $r_minor
+            && $has_patch >= $r_patch)) {
+        return 1;
+    }
+    else {
+        return 0;
+    }
+}
+
  sub perl_ccopts {
      my $self = shift;



-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message