develooper Front page | perl.perl5.porters | Postings from May 2001

Re: Making perl with -Wall

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
May 24, 2001 08:04
Subject:
Re: Making perl with -Wall
Message ID:
20010524150446.10282.5@dromedary.ni-s.u-net.com
Michael G Schwern <schwern@pobox.com> writes:
>On Thu, May 24, 2001 at 02:06:39PM +0000, Nick Ing-Simmons wrote:
>> >> There is a GCC attribute that will silence the warning
>> >
>> >What about all the other compilers?
>> 
>> We don't know how to do -Wall on other compilers ;-)
>> Though I agree some of them are noisy in this area by default.
>
>'unused' is the attribute.
>
>
>Well, here's a first stab.  It shuts up all the not used warnings.
>It probably needs a better check than HASATTRIBUTE, perhaps to see
>if that specific attribute (unused) is available.

Tk's myConfigure (part of its Makefile.PL scheme) does this:

  $ver = $Config{'gccversion'};
  if ($ver ge "2.8")
   {
    $gccopt .= " -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__";

Which I seem to recall was when I was doing same sort if thing in 
Tk, and older gcc did not like -Wno-unused, which I _think_ came
in at same time as the attribute.

>
>It also looks like there's some bits in the JPL that probably have
>the same issue.
>
>And -Wall has to be added to the config defaults for gcc.  I'll leave
>that up to someone else, where that someone else may or may not be
>Jarko-shaped.
>
>
>--- perl.h	2001/05/24 14:22:39	1.2
>+++ perl.h	2001/05/24 14:27:24
>@@ -226,7 +226,11 @@
> #endif
> 
> #define NOOP (void)0
>+#ifdef HASATTRIBUTE
>+#define dNOOP extern int Perl___notused __attribute__ ((unused))
>+#else
> #define dNOOP extern int Perl___notused
>+#endif
> 
> #ifndef pTHX
> #  define pTHX		void
>--- malloc.c	2001/05/24 14:22:45	1.1
>+++ malloc.c	2001/05/24 14:30:57
>@@ -304,7 +304,11 @@
> #  ifndef pTHX
> #     define pTHX		void
> #     define pTHX_
>-#     define dTHX		extern int Perl___notused
>+#     ifdef HASATTRIBUTE
>+#        define dTHX		extern int Perl___notused __attribute__ ((unused))
>+#     else
>+#        define dTHX            extern int Perl___notused
>+#     endif
> #     define WITH_THX(s)	s
> #  endif
> #  ifndef PERL_GET_INTERP
-- 
Nick Ing-Simmons
who is looking for a new job see http://www.ni-s.u-net.com/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About