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

Re: Making perl with -Wall

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
May 24, 2001 07:40
Subject:
Re: Making perl with -Wall
Message ID:
20010524154028.B1988@blackrider.blackstar.co.uk
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, what I'm more curious about is why we have a variable called
> >"Perl___notused" at all and not simply an empty macro?
> 
> Because it is a declaration, and there is a following ';'.

Ahh, right.  {;;;;;;;;} isn't valid in C.

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.

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



-- 

Michael G. Schwern   <schwern@pobox.com>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>	     Kwalitee Is Job One
i gave them some paste
do that funky dance, white boy
i laughed my ass off
	-- Fmh

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