diff --git a/include/wx/defs.h b/include/wx/defs.h index 441baa5571..6cc9f7376a 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -547,7 +547,7 @@ typedef short int WXTYPE; #else #define wxDEPRECATED_MSG(msg) __attribute__((deprecated)) #endif -#elif wxCHECK_GCC_VERSION(4, 5) +#elif defined(__GNUC__) #define wxDEPRECATED_MSG(msg) __attribute__((deprecated(msg))) #elif wxCHECK_VISUALC_VERSION(8) #define wxDEPRECATED_MSG(msg) __declspec(deprecated("deprecated: " msg)) @@ -644,7 +644,7 @@ typedef short int WXTYPE; Note that these macros apply to both gcc and clang, even though they only have "GCC" in their names. */ -#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6) +#if defined(__clang__) || defined(__GNUC__) # define wxGCC_WARNING_SUPPRESS(x) \ _Pragma (wxSTRINGIZE(GCC diagnostic push)) \ _Pragma (wxSTRINGIZE(GCC diagnostic ignored wxSTRINGIZE(wxCONCAT(-W,x)))) diff --git a/include/wx/dlimpexp.h b/include/wx/dlimpexp.h index fd75cb9d15..a1be764de0 100644 --- a/include/wx/dlimpexp.h +++ b/include/wx/dlimpexp.h @@ -25,17 +25,7 @@ # if defined(__VISUALC__) # define WXEXPORT __declspec(dllexport) # define WXIMPORT __declspec(dllimport) - /* - While gcc also supports __declspec(dllexport), it created unusably huge - DLL files in gcc 4.[56] (while taking horribly long amounts of time), - see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this - we rely on binutils auto export/import support which seems to work - quite well for 4.5+. However the problem was fixed in 4.7 and later and - not exporting everything creates smaller DLLs (~8% size difference), so - do use the explicit attributes again for the newer versions. - */ -# elif defined(__GNUC__) && \ - (!wxCHECK_GCC_VERSION(4, 5) || wxCHECK_GCC_VERSION(4, 7)) +# elif defined(__GNUC__) /* __declspec could be used here too but let's use the native __attribute__ instead for clarity. diff --git a/include/wx/platform.h b/include/wx/platform.h index bc240a33c4..3deb0881cd 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -578,7 +578,7 @@ # if !__has_feature(cxx_rtti) # define wxNO_RTTI # endif -# elif wxCHECK_GCC_VERSION(4, 3) +# elif defined(__GNUG__) # ifndef __GXX_RTTI # define wxNO_RTTI # endif diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index b5a89a2dd8..50ebdb8c49 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -454,7 +454,7 @@ wxPG_PROP_CLASS_SPECIFIC_3 = 0x00400000 // ----------------------------------------------------------------------- // Helpers to mark macros as deprecated -#if (defined(__clang__) || wxCHECK_GCC_VERSION(4, 5)) && !defined(WXBUILDING) +#if (defined(__clang__) || defined(__GNUC__)) && !defined(WXBUILDING) #define wxPG_STRINGIFY(X) #X #define wxPG_DEPRECATED_MACRO_VALUE(value, msg) \ _Pragma(wxPG_STRINGIFY(GCC warning msg)) value diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index e165d730cd..37af238994 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -2467,7 +2467,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; //---------------------------------------------------------------------- -#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 5) +#if defined(__clang__) || defined(__GNUC__) #define wxSTC_STRINGIFY(X) #X #define wxSTC_DEPRECATED_MACRO_VALUE(value,msg) \ _Pragma(wxSTC_STRINGIFY(GCC warning msg)) value diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index 6011cf94c9..0dc8e32493 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -64,7 +64,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; //---------------------------------------------------------------------- -#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 5) +#if defined(__clang__) || defined(__GNUC__) #define wxSTC_STRINGIFY(X) #X #define wxSTC_DEPRECATED_MACRO_VALUE(value,msg) \ _Pragma(wxSTC_STRINGIFY(GCC warning msg)) value diff --git a/tests/allheaders.cpp b/tests/allheaders.cpp index 12b938b1c3..62a8544f50 100644 --- a/tests/allheaders.cpp +++ b/tests/allheaders.cpp @@ -18,7 +18,7 @@ #define CHECK_GCC_VERSION(major, minor) 0 #endif -#if CHECK_GCC_VERSION(4, 6) || defined(__clang__) +#if defined(__GNUC__) || defined(__clang__) // As above, we can't reuse wxCONCAT() and wxSTRINGIZE macros from wx/cpp.h // here, so define their equivalents here. #define CONCAT_HELPER(x, y) x ## y @@ -32,12 +32,13 @@ #define WARNING_TURN_OFF(comp, warn) \ _Pragma(STRINGIZE(comp diagnostic ignored STRINGIZE(CONCAT(-W,warn)))) - #if CHECK_GCC_VERSION(4, 6) - #define GCC_TURN_ON(warn) WARNING_TURN_ON(GCC, warn) - #define GCC_TURN_OFF(warn) WARNING_TURN_OFF(GCC, warn) - #elif defined(__clang__) + // Test for clang before gcc as clang defines __GNUC__ too. + #if defined(__clang__) #define CLANG_TURN_ON(warn) WARNING_TURN_ON(clang, warn) #define CLANG_TURN_OFF(warn) WARNING_TURN_OFF(clang, warn) + #elif defined(__GNUC__) + #define GCC_TURN_ON(warn) WARNING_TURN_ON(GCC, warn) + #define GCC_TURN_OFF(warn) WARNING_TURN_OFF(GCC, warn) #endif #endif @@ -83,9 +84,7 @@ #if CHECK_GCC_VERSION(6,1) GCC_TURN_ON(abi) #endif // 6.1 -#if CHECK_GCC_VERSION(4,8) GCC_TURN_ON(abi-tag) -#endif // 4.8 GCC_TURN_ON(address) GCC_TURN_ON(aggregate-return) #if CHECK_GCC_VERSION(7,1) @@ -124,9 +123,7 @@ #if CHECK_GCC_VERSION(4,9) GCC_TURN_ON(date-time) #endif // 4.9 -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(delete-non-virtual-dtor) -#endif // 4.7 #if CHECK_GCC_VERSION(9,1) GCC_TURN_ON(deprecated-copy) #endif // 9.1 @@ -156,24 +153,18 @@ #if CHECK_GCC_VERSION(5,1) GCC_TURN_ON(format-signedness) #endif // 5.1 -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(format-zero-length) -#endif // 4.7 GCC_TURN_ON(ignored-qualifiers) GCC_TURN_ON(init-self) GCC_TURN_ON(inline) GCC_TURN_ON(invalid-pch) -#if CHECK_GCC_VERSION(4,8) GCC_TURN_ON(literal-suffix) -#endif // 4.8 #if CHECK_GCC_VERSION(6,1) GCC_TURN_ON(logical-op) #endif // 6.1 GCC_TURN_ON(long-long) GCC_TURN_ON(main) -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(maybe-uninitialized) -#endif // 4.7 #if CHECK_GCC_VERSION(10,1) GCC_TURN_ON(mismatched-tags) #endif // 10.1 @@ -187,17 +178,13 @@ #if CHECK_GCC_VERSION(6,1) GCC_TURN_ON(namespaces) #endif // 6.1 -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(narrowing) -#endif // 4.7 GCC_TURN_ON(noexcept) #if CHECK_GCC_VERSION(7,1) GCC_TURN_ON(noexcept-type) #endif // 7.1 GCC_TURN_ON(non-virtual-dtor) -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(nonnull) -#endif // 4.7 #if CHECK_GCC_VERSION(6,1) GCC_TURN_ON(null-dereference) #endif // 6.1 @@ -246,9 +233,7 @@ GCC_TURN_ON(suggest-attribute=cold) #endif // 8.1 GCC_TURN_ON(suggest-attribute=const) -#if CHECK_GCC_VERSION(4,8) GCC_TURN_ON(suggest-attribute=format) -#endif // 4.8 #if CHECK_GCC_VERSION(8,1) GCC_TURN_ON(suggest-attribute=malloc) #endif // 8.1 @@ -283,20 +268,14 @@ GCC_TURN_ON(unused-but-set-variable) GCC_TURN_ON(unused-function) GCC_TURN_ON(unused-label) -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(unused-local-typedefs) -#endif // 4.7 GCC_TURN_ON(unused-macros) GCC_TURN_ON(unused-parameter) GCC_TURN_ON(unused-value) GCC_TURN_ON(unused-variable) -#if CHECK_GCC_VERSION(4,8) GCC_TURN_ON(useless-cast) -#endif // 4.8 GCC_TURN_ON(variadic-macros) -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(vector-operation-performance) -#endif // 4.7 #if CHECK_GCC_VERSION(6,1) GCC_TURN_ON(virtual-inheritance) #endif // 6.1 @@ -306,9 +285,7 @@ #endif // 10.1 GCC_TURN_ON(volatile-register-var) GCC_TURN_ON(write-strings) -#if CHECK_GCC_VERSION(4,7) GCC_TURN_ON(zero-as-null-pointer-constant) -#endif // 4.7 // }}} #undef GCC_TURN_ON @@ -324,9 +301,7 @@ GCC_TURN_OFF(sign-conversion) GCC_TURN_OFF(old-style-cast) -#if CHECK_GCC_VERSION(4,8) GCC_TURN_OFF(useless-cast) -#endif // 4.8 #if CHECK_GCC_VERSION(10,1) GCC_TURN_OFF(redundant-tags) // "struct tm" triggers this @@ -334,7 +309,7 @@ // This one is given for NULL, and not just literal 0, up to gcc 10, and so // has to remain disabled for as long as we use any NULLs in our code. -#if CHECK_GCC_VERSION(4,7) && !CHECK_GCC_VERSION(10,1) +#if !CHECK_GCC_VERSION(10,1) GCC_TURN_OFF(zero-as-null-pointer-constant) #endif @@ -356,9 +331,7 @@ // This one is given whenever inheriting from std:: classes without using // C++11 ABI tag explicitly, probably harmless. -#if CHECK_GCC_VERSION(4,8) GCC_TURN_OFF(abi-tag) -#endif // 4.8 // This can be used to ask the compiler to explain why some function is not // inlined, but it's perfectly normal for some functions not to be inlined. diff --git a/tests/log/logtest.cpp b/tests/log/logtest.cpp index 94d05e737d..75a055b4b7 100644 --- a/tests/log/logtest.cpp +++ b/tests/log/logtest.cpp @@ -300,7 +300,7 @@ void LogTestCase::NoWarnings() // The following two functions (v, macroCompilabilityTest) are not run by // any test, and their purpose is merely to guarantee that the wx(V)LogXXX // macros compile without 'dangling else' warnings. -#if defined(__clang__) || wxCHECK_GCC_VERSION(4, 6) +#if defined(__clang__) || defined(__GNUC__) // gcc 7 split -Wdangling-else from the much older -Wparentheses, so use // the new warning if it's available or the old one otherwise. #if wxCHECK_GCC_VERSION(7, 0)