From: Jarkko Hietaniemi Date: Tue, 17 May 2005 20:36:43 +0000 (+0300) Subject: more about __attribute__ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f22be1b8bd009cf4b53bd4bad9a8883a7dc9f572;p=p5sagit%2Fp5-mst-13.2.git more about __attribute__ Message-ID: <428A2BAB.9020306@gmail.com> p4raw-id: //depot/perl@24495 --- diff --git a/perl.h b/perl.h index 05d81f9..cb64a6e 100644 --- a/perl.h +++ b/perl.h @@ -2558,17 +2558,39 @@ typedef pthread_key_t perl_key; # endif #endif +/* See http://www.ohse.de/uwe/articles/gcc-attributes.html, but + * contrary to the information warn_unused_result seems not to be in + * gcc 3.3.5, at least. --jhi */ + #if __GNUC__ >= 3 # define __attribute__malloc__ __attribute__((malloc)) +#endif +#if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 # define __attribute__nonnull__(a) __attribute__((nonnull(a))) +#endif +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 # define __attribute__noreturn__ __attribute__((noreturn)) +#endif +#if __GNUC__ >= 3 # define __attribute__pure__ __attribute__((pure)) +#endif +#if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 # define __attribute__warn_unused_result__ __attribute__((warn_unused_result)) -#else +#endif + +#ifndef __attribute__malloc__ # define __attribute__malloc__ +#endif +#ifndef __attribute__nonnull__ # define __attribute__nonnull__(a) +#endif +#ifndef __attribute__noreturn__ # define __attribute__noreturn__ +#endif +#ifndef __attribute__pure__ # define __attribute__pure__ +#endif +#ifndef __attribute__warn_unused_result__ # define __attribute__warn_unused_result__ #endif