added wxCOMPILE_TIME_ASSERT2() macro allowing to give the unique name to the struct used by wxCOMPILE_TIME_ASSERT() and use it in dynarray.h
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -178,9 +178,10 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
|
|||||||
get a warning about an unnamed struct not used to define an object!).
|
get a warning about an unnamed struct not used to define an object!).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define wxMAKE_ASSERT_NAME_HELPER(line) wxAssert_ ## line
|
#define wxMAKE_ASSERT_NAME_HELPER(line) wxAssert_ ## line
|
||||||
#define wxMAKE_ASSERT_NAME(line) wxMAKE_ASSERT_NAME_HELPER(line)
|
#define wxMAKE_ASSERT_NAME(line) wxMAKE_ASSERT_NAME_HELPER(line)
|
||||||
#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_ASSERT_NAME(__LINE__)
|
#define wxMAKE_UNIQUE_ASSERT_NAME wxMAKE_ASSERT_NAME(__LINE__)
|
||||||
|
#define wxMAKE_UNIQUE_ASSERT_NAME2(text) wxMAKE_ASSERT_NAME(text)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The second argument of this macro must be a valid C++ identifier and not a
|
The second argument of this macro must be a valid C++ identifier and not a
|
||||||
@@ -193,6 +194,9 @@ WXDLLEXPORT_DATA(extern const bool) wxFalse;
|
|||||||
#define wxCOMPILE_TIME_ASSERT(expr, msg) \
|
#define wxCOMPILE_TIME_ASSERT(expr, msg) \
|
||||||
struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; }
|
struct wxMAKE_UNIQUE_ASSERT_NAME { unsigned int msg: expr; }
|
||||||
|
|
||||||
|
#define wxCOMPILE_TIME_ASSERT2(expr, msg, text) \
|
||||||
|
struct wxMAKE_UNIQUE_ASSERT_NAME2(text) { unsigned int msg: expr; }
|
||||||
|
|
||||||
// helpers for wxCOMPILE_TIME_ASSERT below, for private use only
|
// helpers for wxCOMPILE_TIME_ASSERT below, for private use only
|
||||||
#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits
|
#define wxMAKE_BITSIZE_MSG(type, size) type ## SmallerThan ## size ## Bits
|
||||||
|
|
||||||
|
@@ -186,8 +186,9 @@ private:
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define _WX_DEFINE_ARRAY(T, name, classexp) \
|
#define _WX_DEFINE_ARRAY(T, name, classexp) \
|
||||||
wxCOMPILE_TIME_ASSERT(sizeof(T) <= sizeof(long), \
|
wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(long), \
|
||||||
TypeIsTooBigToBeStoredInWxArray); \
|
TypeIsTooBigToBeStoredInWxArray, \
|
||||||
|
name); \
|
||||||
typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \
|
typedef int (CMPFUNC_CONV *CMPFUNC##T)(T *pItem1, T *pItem2); \
|
||||||
classexp name : public wxBaseArray \
|
classexp name : public wxBaseArray \
|
||||||
{ \
|
{ \
|
||||||
@@ -230,8 +231,9 @@ public: \
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define _WX_DEFINE_SORTED_ARRAY(T, name, defcomp, classexp) \
|
#define _WX_DEFINE_SORTED_ARRAY(T, name, defcomp, classexp) \
|
||||||
wxCOMPILE_TIME_ASSERT(sizeof(T) <= sizeof(long), \
|
wxCOMPILE_TIME_ASSERT2(sizeof(T) <= sizeof(long), \
|
||||||
TypeIsTooBigToBeStoredInWxArray); \
|
TypeIsTooBigToBeStoredInWxArray, \
|
||||||
|
name); \
|
||||||
typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2); \
|
typedef int (CMPFUNC_CONV *SCMPFUNC##T)(T pItem1, T pItem2); \
|
||||||
classexp name : public wxBaseArray \
|
classexp name : public wxBaseArray \
|
||||||
{ \
|
{ \
|
||||||
|
Reference in New Issue
Block a user