On Sun, Apr 10, 2005 at 05:03:58PM -0500, Andy Lester wrote:
> Attached is a patch that does for DBI what I've been doing in the Perl
> core the past few weeks:
> 
> * Apply const qualifiers where possible
> * Localize auto variables to internal blocks where possible
> * Clean up complaints from high-stress GCC compiler warnings.
> 
> I've been building by using this set of changes to Makefile.PL, which
> makes GCC pretty picky:
> 
> Index: Makefile.PL
> ===================================================================
> --- Makefile.PL       (.../DBI-1.48)  (revision 17)
> +++ Makefile.PL       (.../trunk)     (revision 17)
> @@ -127,6 +127,7 @@
>      VERSION_FROM=> 'DBI.pm',
>      PREREQ_PM => { "Test::Simple" => 0.40 },
>      EXE_FILES => [ "dbiproxy$ext_pl", "dbiprof$ext_pl" ],
> +    CCFLAGS =>'-DDEBUGGING -DPERL_GCC_PEDANTIC -ansi -pedantic -W 
> -Wno-sign-compare -Wall -Wno-cast-qual -Wpointer-arith -Wmissing-prototypes 
> -Wmissing-noreturn -Wdisabled-optimization -Wbad-function-cast',
>      DIR => [ ],
>      dynamic_lib => { OTHERLDFLAGS => "$::opt_g" },
>      clean => { FILES=> "\$(DISTVNAME) Perl.xsi t/zv*_*.t"
> 
> Is this patch something you find useful?  If so, I can keep digging.

Sure, so long as it'll still build fine with other compilers.
(So that CCFLAGS line can't be left as-is :)

> This is just from blowing through this for a couple of hours this
> afternoon.

Great. Did adding consts actually find any bugs?

I've applied the patch (change #970) and make a few tweaks.  I needed to
add a 'const char *' entry to the typemap file for Perl 5.6.  I've also
reworked the way gcc flags get set and enabled more of them by default.

Thanks again Andy.

dbi-dev'ers - I'd be grateful if anyone on slightly unusual platforms
(including Win32 :) could test the current code in svn to see if
anything upsets your compiler. Thanks.

Tim.

Reply via email to