diff --git a/include/wx/defs.h b/include/wx/defs.h index 102e8c9950..01b7c228a1 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -697,6 +697,36 @@ typedef short int WXTYPE; # define wxDEPRECATED_BUT_USED_INTERNALLY(x) wxDEPRECATED(x) #endif +/* + Some gcc versions choke on __has_cpp_attribute(gnu::visibility) due to the + presence of the colon, but we only need this macro in C++ code, so just + don't define it when using C. + */ +#ifdef __cplusplus + +/* + Special macro used for the classes that are exported and deprecated. + It exists because standard [[deprecated]] attribute can't be combined with + legacy __attribute__((visibility)), but we can't use [[visibility]] instead + of the latter because it can't be use in the same place in the declarations + where we use WXDLLIMPEXP_CORE. So we define this special macro which uses + the standard visibility attribute just where we can't do otherwise. + */ +#ifdef wxHAS_DEPRECATED_ATTR + #if __has_cpp_attribute(gnu::visibility) + #define wxDEPRECATED_EXPORT_CORE(msg) \ + [[deprecated(msg), gnu::visibility("default")]] + #endif +#endif + +#ifndef wxDEPRECATED_EXPORT_CORE + /* Fall back when nothing special is needed or available. */ + #define wxDEPRECATED_EXPORT_CORE(msg) \ + wxDEPRECATED_MSG(msg) WXDLLIMPEXP_CORE +#endif + +#endif /* __cplusplus */ + /* Macros to suppress and restore gcc warnings, requires g++ >= 4.6 and don't do anything otherwise. diff --git a/include/wx/matrix.h b/include/wx/matrix.h index d18a0d2321..3b3225d3fa 100644 --- a/include/wx/matrix.h +++ b/include/wx/matrix.h @@ -38,10 +38,8 @@ // At all times m_isIdentity is set if the matrix itself is an Identity matrix. // It is used where possible to optimize calculations. class -#ifndef WXBUILDING -wxDEPRECATED_MSG("use wxAffineMatrix2D instead") -#endif -WXDLLIMPEXP_CORE wxTransformMatrix: public wxObject +wxDEPRECATED_EXPORT_CORE("use wxAffineMatrix2D instead") +wxTransformMatrix: public wxObject { public: wxTransformMatrix();