Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 94859 invoked from network); 12 Aug 2005 19:01:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Aug 2005 19:01:47 -0000 Received: (qmail 35519 invoked by uid 500); 12 Aug 2005 19:01:47 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 35489 invoked by uid 500); 12 Aug 2005 19:01:46 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 35476 invoked by uid 99); 12 Aug 2005 19:01:46 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2005 12:01:46 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gozer@ectoplasm.org designates 66.34.202.202 as permitted sender) Received: from [66.34.202.202] (HELO minerva.ectoplasm.org) (66.34.202.202) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2005 12:02:06 -0700 Received: from minerva.ectoplasm.org (localhost.localdomain [127.0.0.1]) by pmx.secure.ectoplasm.org (Postfix) with SMTP id A8E4E5EB32; Fri, 12 Aug 2005 12:01:43 -0700 (PDT) Received: from [192.168.10.200] (unknown [192.168.10.200]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by minerva.ectoplasm.org (Postfix) with ESMTP id 543EE5EB1E; Fri, 12 Aug 2005 12:01:43 -0700 (PDT) Message-ID: <42FCF20C.1030301@ectoplasm.org> Date: Fri, 12 Aug 2005 12:01:32 -0700 From: "Philippe M. Chiasson" User-Agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Philip M. Gollucci" CC: dev@perl.apache.org Subject: Re: -Wdeclaration-after-statement Final version References: <42FC31F2.5060300@p6m7g8.com> In-Reply-To: <42FC31F2.5060300@p6m7g8.com> X-Enigmail-Version: 0.91.0.0 Content-Type: multipart/signed; micalg=pgp-ripemd160; protocol="application/pgp-signature"; boundary="------------enigB47998807F34009BA018CBD2" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------enigB47998807F34009BA018CBD2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Philip M. Gollucci wrote: > Third and final take. No objects and I'll commit. I combined all 3 of > the verions. :) Who would have thought something so small would take so > long? I am not so surprised ;-) I've seen patches take many more iterations than this one before going thru. It's one way to keep the codebase clean and concise (and hopefully bug-free). > =================================================================== > --- lib/Apache2/Build.pm (revision 230957) > +++ lib/Apache2/Build.pm (working copy) > @@ -518,10 +518,21 @@ > > if ($self->{MP_MAINTAINER}) { > $self->{MP_DEBUG} = 1; > - if ($self->perl_config('gccversion')) { > + > + if (my $gccversion = $self->perl_config('gccversion')) { > #same as --with-maintainter-mode > $ccopts .= " $Wall -DAP_DEBUG"; > $ccopts .= " -DAP_HAVE_DESIGNATED_INITIALIZER"; > + > + my ($gcc_major, $gcc_minor, $gcc_patch) = > + $gccversion =~ /^(\d)\.(\d+)\.(\d+)/; > + > + my $gccversion_decimal = $gcc_major . > + $gcc_minor . $gcc_patch; > + > + ## GCC 3.3.2+ if ($gcc_major > 3 || $gcc_major == 3 && ( $gcc_minor > 3 || $gcc_minor == 3 && $gcc_patch >= 2 )) { > + if ($gccversion_decimal > 332) { > + $ccopts .= " -Wdeclaration-after-statement"; > + } > } > } Getting version arithmetic is always a pita, for instance, the decimal concat version will fail if there is such a thing as gcc-3.2.10 or gcc-2.95.2. sub check_gcc332_if { my $gccversion = shift; my ($gcc_major, $gcc_minor, $gcc_patch) = $gccversion =~ /^(\d)\.(\d+)\.(\d+)/; if ( $gcc_major > 3 || $gcc_major == 3 && ($gcc_minor > 3 || $gcc_minor == 3 && $gcc_patch > 2)) { return 1; } return; } sub check_gcc332_dec { my $gccversion = shift; my ($gcc_major, $gcc_minor, $gcc_patch) = $gccversion =~ /^(\d)\.(\d+)\.(\d+)/; my $gccversion_decimal = $gcc_major . $gcc_minor . $gcc_patch; if ($gccversion_decimal > 332) { return 1; } return; } #using version.pm sub check_gcc332_ver { require version; my $v = version::qv(shift); return $v > version::qv('3.3.2'); } use Test::More qw(no_plan); foreach my $v (qw(2.3.4 2.96.4 3.0.0 3.1.0 3.2.0 3.3.0 3.3.1 3.3.2 3 3.3.2 3.2.10)) { ok !check_gcc332_if($v), "if $v"; ok !check_gcc332_dec($v), "dec $v"; ok !check_gcc332_ver($v), "ver $v"; } foreach my $v (qw(3.3.3 3.3.10 3.4.10 4.0.0 4.10.1)) { ok check_gcc332_if($v), "if $v"; ok check_gcc332_dec($v), "dec $v"; ok check_gcc332_ver($v), "ver $v"; } -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5 --------------enigB47998807F34009BA018CBD2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFC/PIWyzKhB4jDpaURAxlYAJ92PPZmwbiRBURgIWbKobCDFeQIlgCghatt gnKB1F25I5K0ev/BFkMP8d4= =LtKh -----END PGP SIGNATURE----- --------------enigB47998807F34009BA018CBD2--