From: Steve Hay Date: Fri, 24 Jun 2005 13:56:15 +0000 (+0000) Subject: Stop '"__attribute__format__" redefined' warnings from gcc on Win32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c80263a809faf4e39544f5f3f44ed7181a92391b;p=p5sagit%2Fp5-mst-13.2.git Stop '"__attribute__format__" redefined' warnings from gcc on Win32 p4raw-id: //depot/perl@24975 --- diff --git a/perl.h b/perl.h index 262e00c..4c09cd6 100644 --- a/perl.h +++ b/perl.h @@ -2386,6 +2386,41 @@ typedef struct clone_params CLONE_PARAMS; # endif #endif +/* In case Configure was not used (we are using a "canned config" + * such as Win32, or a cross-compilation setup, for example) try going + * by the gcc major and minor versions. One useful URL is + * http://www.ohse.de/uwe/articles/gcc-attributes.html, + * but contrary to this information warn_unused_result seems + * not to be in gcc 3.3.5, at least. --jhi + * Set these up now otherwise we get confused when some of the <*thread.h> + * includes below indirectly pull in (which needs to know if we + * have HASATTRIBUTE_FORMAT). + */ + +#if defined __GNUC__ +# if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */ +# define HASATTRIBUTE_FORMAT +# endif +# if __GNUC__ >= 3 /* 3.0 -> */ +# define HASATTRIBUTE_MALLOC +# endif +# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */ +# define HASATTRIBUTE_NONNULL +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */ +# define HASATTRIBUTE_NORETURN +# endif +# if __GNUC__ >= 3 /* gcc 3.0 -> */ +# define HASATTRIBUTE_PURE +# endif +# if __GNUC__ >= 3 /* gcc 3.0 -> */ /* XXX Verify this version */ +# define HASATTRIBUTE_UNUSED +# endif +# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */ +# define HASATTRIBUTE_WARN_UNUSED_RESULT +# endif +#endif + /* USE_5005THREADS needs to be after unixish.h as includes * which defines NSIG - which will stop inclusion of * this results in many functions being undeclared which bothers C++ @@ -2602,37 +2637,6 @@ typedef pthread_key_t perl_key; # define DieNull Perl_vdie(aTHX_ Nullch, Null(va_list *)) #endif -/* In case Configure was not used (we are using a "canned config" - * such as Win32, or a cross-compilation setup, for example) try going - * by the gcc major and minor versions. One useful URL is - * http://www.ohse.de/uwe/articles/gcc-attributes.html, - * but contrary to this information warn_unused_result seems - * not to be in gcc 3.3.5, at least. --jhi */ -#if defined __GNUC__ -# if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */ -# define HASATTRIBUTE_FORMAT -# endif -# if __GNUC__ >= 3 /* 3.0 -> */ -# define HASATTRIBUTE_MALLOC -# endif -# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */ -# define HASATTRIBUTE_NONNULL -# endif -# if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */ -# define HASATTRIBUTE_NORETURN -# endif -# if __GNUC__ >= 3 /* gcc 3.0 -> */ -# define HASATTRIBUTE_PURE -# endif -# if __GNUC__ >= 3 /* gcc 3.0 -> */ /* XXX Verify this version */ -# define HASATTRIBUTE_UNUSED -# endif -# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */ -# define HASATTRIBUTE_WARN_UNUSED_RESULT -# endif -#endif - - #ifdef HASATTRIBUTE_FORMAT # define __attribute__format__(x,y,z) __attribute__((format(x,y,z))) #endif diff --git a/win32/config_H.gc b/win32/config_H.gc index 56ab22a..1340061 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -1548,6 +1548,11 @@ */ #define HAS_ACCESS /**/ +/* The HASATTRIBUTE_* defines are left undefined here because they vary from + * one version of GCC to another. Instead, they are defined on the basis of + * the compiler version in . + */ + /* HASATTRIBUTE_FORMAT: * Can we handle GCC attribute for checking printf-style formats */