From: Vadim Zeitlin Date: Sun, 23 Jun 2013 00:53:15 +0000 (+0000) Subject: Add WX_ATTRIBUTE_UNUSED and use it for typedefs to avoid g++ 4.8 warnings. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/540dacb643455dd391e43407ee0b3193467b9ee1?ds=inline 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 --- diff --git a/include/wx/checkeddelete.h b/include/wx/checkeddelete.h index a03d7454d6..d77abd7cce 100644 --- a/include/wx/checkeddelete.h +++ b/include/wx/checkeddelete.h @@ -30,13 +30,13 @@ #define wxCHECKED_DELETE(ptr) \ wxSTATEMENT_MACRO_BEGIN \ - typedef char complete[sizeof(*ptr)]; \ + typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \ delete ptr; \ wxSTATEMENT_MACRO_END #define wxCHECKED_DELETE_ARRAY(ptr) \ wxSTATEMENT_MACRO_BEGIN \ - typedef char complete[sizeof(*ptr)]; \ + typedef char complete[sizeof(*ptr)] WX_ATTRIBUTE_UNUSED; \ delete [] ptr; \ wxSTATEMENT_MACRO_END diff --git a/include/wx/defs.h b/include/wx/defs.h index daa9d50598..e418ef41cd 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -538,6 +538,12 @@ typedef short int WXTYPE; # 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: */ #if wxCHECK_GCC_VERSION(3, 1) #define wxDEPRECATED(x) __attribute__((deprecated)) x @@ -631,7 +637,7 @@ typedef short int WXTYPE; template inline void wxDELETE(T*& ptr) { - typedef char TypeIsCompleteCheck[sizeof(T)]; + typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; if ( ptr != NULL ) { @@ -644,7 +650,7 @@ typedef short int WXTYPE; template inline void wxDELETEA(T*& ptr) { - typedef char TypeIsCompleteCheck[sizeof(T)]; + typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED; if ( ptr != NULL ) {