]> git.saurik.com Git - wxWidgets.git/commitdiff
Add WX_ATTRIBUTE_UNUSED and use it for typedefs to avoid g++ 4.8 warnings.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 00:53:15 +0000 (00:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 00:53:15 +0000 (00:53 +0000)
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

include/wx/checkeddelete.h
include/wx/defs.h

index a03d7454d62d126e63d544b8815e8826909d32b9..d77abd7cce9b6248d13dcf2184d1b4d64f33a5a0 100644 (file)
 
 #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
 
index daa9d505982f59602c7b908f4cb3995d39a988c7..e418ef41cd5ef2174b82dd2d7bf92b7589548ca3 100644 (file)
@@ -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 <typename T>
     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 <typename T>
     inline void wxDELETEA(T*& ptr)
     {
-        typedef char TypeIsCompleteCheck[sizeof(T)];
+        typedef char TypeIsCompleteCheck[sizeof(T)] WX_ATTRIBUTE_UNUSED;
 
         if ( ptr != NULL )
         {