Add WX_ATTRIBUTE_UNUSED and use it for typedefs to avoid g++ 4.8 warnings.

g++ 4.8 warns about unused typedef's in local scope resulting in hundreds of
warnings when building wx, suppress them by using WX_ATTRIBUTE_UNUSED for
these typedefs.

Closes #15137.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74272 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-06-23 00:53:15 +00:00
parent cb50bdc075
commit 540dacb643
2 changed files with 10 additions and 4 deletions

View File

@@ -30,13 +30,13 @@
#define wxCHECKED_DELETE(ptr) \ #define wxCHECKED_DELETE(ptr) \
wxSTATEMENT_MACRO_BEGIN \ wxSTATEMENT_MACRO_BEGIN \
typedef char complete[sizeof(*ptr)]; \ typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \
delete ptr; \ delete ptr; \
wxSTATEMENT_MACRO_END wxSTATEMENT_MACRO_END
#define wxCHECKED_DELETE_ARRAY(ptr) \ #define wxCHECKED_DELETE_ARRAY(ptr) \
wxSTATEMENT_MACRO_BEGIN \ wxSTATEMENT_MACRO_BEGIN \
typedef char complete[sizeof(*ptr)]; \ typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \
delete [] ptr; \ delete [] ptr; \
wxSTATEMENT_MACRO_END wxSTATEMENT_MACRO_END

View File

@@ -538,6 +538,12 @@ typedef short int WXTYPE;
# endif # endif
#endif #endif
#if defined(__GNUC__)
#define WX_ATTRIBUTE_UNUSED __attribute__ ((unused))
#else
#define WX_ATTRIBUTE_UNUSED
#endif
/* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */ /* Macro to issue warning when using deprecated functions with gcc3 or MSVC7: */
#if wxCHECK_GCC_VERSION(3, 1) #if wxCHECK_GCC_VERSION(3, 1)
#define wxDEPRECATED(x) __attribute__((deprecated)) x #define wxDEPRECATED(x) __attribute__((deprecated)) x
@@ -631,7 +637,7 @@ typedef short int WXTYPE;
template <typename T> template <typename T>
inline void wxDELETE(T*& ptr) inline void wxDELETE(T*& ptr)
{ {
typedef char TypeIsCompleteCheck[sizeof(T)]; typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
if ( ptr != NULL ) if ( ptr != NULL )
{ {
@@ -644,7 +650,7 @@ typedef short int WXTYPE;
template <typename T> template <typename T>
inline void wxDELETEA(T*& ptr) inline void wxDELETEA(T*& ptr)
{ {
typedef char TypeIsCompleteCheck[sizeof(T)]; typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
if ( ptr != NULL ) if ( ptr != NULL )
{ {