perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: bugs_build TODO completed -Wdeclaration-after-statement
Date Tue, 09 Aug 2005 18:39:49 GMT
Philip M. Gollucci wrote:
> All,
> 
> Can I have some +/- 1s please ? :)
> 
> Patch attached.
> 
> I'll confirm this "works" on at least the following:
> FreeBSD 5.4-RELEASE
> FreeBSD 6.0-BETA2
> FreeBSD 7.0-CURRENT
> 
> and
> 
> Linux 2.4.21-15.EL #1 i686 i686 i386 GNU/Linux
> 
> with perl 5.8.7 and latest SVN of mp2.
> 
> 
> [...]
> Index: lib/Apache2/Build.pm
> ===================================================================
> --- lib/Apache2/Build.pm	(revision 230957)
> +++ lib/Apache2/Build.pm	(working copy)
> @@ -518,10 +518,22 @@
>  
>      if ($self->{MP_MAINTAINER}) {
>          $self->{MP_DEBUG} = 1;
> -        if ($self->perl_config('gccversion')) {
> +        
> +        my $gccversion;

Isn't that my ^^^ redundant ?

> +        if (my $gccversion = $self->perl_config('gccversion')) {
>              #same as --with-maintainter-mode
>              $ccopts .= " $Wall -DAP_DEBUG";
>              $ccopts .= " -DAP_HAVE_DESIGNATED_INITIALIZER";
> +
> +            $gccversion =~ /^(.*?)\s/;
> +            $gccversion = $1;
> +            $gccversion =~ s/\D//g;
> +
> +            $gccversion = $gccversion . "0" if length $gccversion < 3;
> +
> +            if ($gccversion >= 332) {
> +              $ccopts .= " -Wdeclaration-after-statement";
> +            }
>          }
>      }

I suspect the version parsing could be simplified to something
more explicit like this :

my ($maj, $min, $patch) = $gccversion =~ /^(\d+)\.(\d+)\.(\d+)/;
 or
my ($maj, $min, $patch) = split /\./, $gccversion;

#Gcc 3.3.2 and higher
if ($maj >= 3 && $min >= 3 && $patch >= 2) {
    $ccopts .= " -Wdeclaration-after-statement";
}

--------------------------------------------------------------------------------
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

Mime
View raw message