diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index f50e1f5f5..3d60a2a7b 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,13 @@ +2004-07-21 Danny Smith + + * include/_mingw.h: Undefine __attribute__. + (__MINGW_ATTR_NORETURN): New define. + (__MINGW_ATTR_CONST): New define. + (__MINGW_ATTR_MALLOC): New define. + (__MINGW_ATTR_PURE): New define. + (_CRTIMP, __cdecl, __stdcall, __UNUSED_PARAM): Ansi-fy + expansions. + 2004-07-19 Danny Smith * include/time.h (__time64_t): Add missing ';'. diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h index 5b91ac0ee..602535ed6 100644 --- a/winsup/mingw/include/_mingw.h +++ b/winsup/mingw/include/_mingw.h @@ -37,13 +37,16 @@ Other macros: - __int64 define to be long long. Using a typedef can - tweak bugs in the C++ parser. + __int64 define to be long long. Using a typedef doesn't + work for "unsigned __int64" All headers should include this first, and then use __DECLSPEC_SUPPORTED to choose between the old ``__imp__name'' style or __MINGW_IMPORT style declarations. */ +/* Try to avoid problems with outdated checks for GCC __attribute__ support. */ +#undef __attribute__ + #ifndef __GNUC__ # ifndef __MINGW_IMPORT # define __MINGW_IMPORT __declspec(dllimport) @@ -58,11 +61,11 @@ # ifndef __MINGW_IMPORT /* Note the extern. This is needed to work around GCC's limitations in handling dllimport attribute. */ -# define __MINGW_IMPORT extern __attribute__((dllimport)) +# define __MINGW_IMPORT extern __attribute__ ((dllimport)) # endif # ifndef _CRTIMP # ifdef __USE_CRTIMP -# define _CRTIMP __attribute__((dllimport)) +# define _CRTIMP __attribute__ ((dllimport)) # else # define _CRTIMP # endif @@ -76,10 +79,10 @@ # endif # endif /* __declspec */ # ifndef __cdecl -# define __cdecl __attribute__((cdecl)) +# define __cdecl __attribute__ ((__cdecl__)) # endif # ifndef __stdcall -# define __stdcall __attribute__((stdcall)) +# define __stdcall __attribute__ ((__stdcall__)) # endif # ifndef __int64 # define __int64 long long @@ -111,12 +114,28 @@ # define __UNUSED_PARAM(x) #else # ifdef __GNUC__ -# define __UNUSED_PARAM(x) x __attribute__((unused)) +# define __UNUSED_PARAM(x) x __attribute__ ((__unused__)) # else # define __UNUSED_PARAM(x) x # endif #endif +#ifdef __GNUC__ +#define __MINGW_ATTR_NORETURN __attribute__ ((__noreturn__)) +#define __MINGW_ATTR_CONST __attribute__ ((__const__)) +#else +#define __MINGW_ATTR_NORETURN +#define __MINGW_ATTR_CONST +#endif + +#if ( __GNUC__ >= 3) +#define __MINGW_ATTR_MALLOC __attribute__ ((__malloc__)) +#define __MINGW_ATTR_PURE __attribute__ ((__pure__)) +#else +#define __MINGW_ATTR_MALLOC +#define __MINGW_ATTR_PURE +#endif + #ifndef __MSVCRT_VERSION__ /* High byte is the major version, low byte is the minor. */ # define __MSVCRT_VERSION__ 0x0600