This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
g++ groks __attribute__((unused)) at least since 4.3.6.
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 6 Dec 2014 15:14:30 +0000 (10:14 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 6 Dec 2014 19:30:55 +0000 (14:30 -0500)
Cannot find the exact moment from gcc release notes, but tests fine in 4.3.6.
(not fine = "warning: unused ...")

perl.h

diff --git a/perl.h b/perl.h
index 193458c..8466bc7 100644 (file)
--- a/perl.h
+++ b/perl.h
 #endif
 
 #ifndef PERL_UNUSED_DECL
-#  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
+#  if defined(HASATTRIBUTE_UNUSED) && (!defined(__cplusplus) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))
 #    define PERL_UNUSED_DECL __attribute__unused__
 #  else
 #    define PERL_UNUSED_DECL