Check for most clang warnings in our headers in the test suite
Make allheaders unit test also enable -Wall, -Wextra and -Wpedantic for clang to detect any warnings it might give in wx headers. Don't use -Weverything because there are just too many warnings we'd need to disable then.
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
#define CHECK_GCC_VERSION(major, minor) 0
|
#define CHECK_GCC_VERSION(major, minor) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CHECK_GCC_VERSION(4, 6)
|
#if CHECK_GCC_VERSION(4, 6) || defined(__clang__)
|
||||||
// As above, we can't reuse wxCONCAT() and wxSTRINGIZE macros from wx/cpp.h
|
// As above, we can't reuse wxCONCAT() and wxSTRINGIZE macros from wx/cpp.h
|
||||||
// here, so define their equivalents here.
|
// here, so define their equivalents here.
|
||||||
#define CONCAT_HELPER(x, y) x ## y
|
#define CONCAT_HELPER(x, y) x ## y
|
||||||
@@ -27,10 +27,18 @@
|
|||||||
#define STRINGIZE_HELPER(x) #x
|
#define STRINGIZE_HELPER(x) #x
|
||||||
#define STRINGIZE(x) STRINGIZE_HELPER(x)
|
#define STRINGIZE(x) STRINGIZE_HELPER(x)
|
||||||
|
|
||||||
#define GCC_TURN_ON(warn) \
|
#define WARNING_TURN_ON(comp, warn) \
|
||||||
_Pragma(STRINGIZE(GCC diagnostic error STRINGIZE(CONCAT(-W,warn))))
|
_Pragma(STRINGIZE(comp diagnostic error STRINGIZE(CONCAT(-W,warn))))
|
||||||
#define GCC_TURN_OFF(warn) \
|
#define WARNING_TURN_OFF(comp, warn) \
|
||||||
_Pragma(STRINGIZE(GCC diagnostic ignored STRINGIZE(CONCAT(-W,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__)
|
||||||
|
#define CLANG_TURN_ON(warn) WARNING_TURN_ON(clang, warn)
|
||||||
|
#define CLANG_TURN_OFF(warn) WARNING_TURN_OFF(clang, warn)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We have to include this one first in order to check for wxUSE_XXX below.
|
// We have to include this one first in order to check for wxUSE_XXX below.
|
||||||
@@ -374,6 +382,24 @@
|
|||||||
GCC_TURN_OFF(padded)
|
GCC_TURN_OFF(padded)
|
||||||
#endif // gcc >= 4.6
|
#endif // gcc >= 4.6
|
||||||
|
|
||||||
|
// Do the same for clang too except here we don't bother with the individual
|
||||||
|
// warnings and just enable the usual ones because clang mostly includes all
|
||||||
|
// the useful warnings in them anyhow.
|
||||||
|
#ifdef CLANG_TURN_ON
|
||||||
|
CLANG_TURN_ON(all)
|
||||||
|
CLANG_TURN_ON(extra)
|
||||||
|
CLANG_TURN_ON(pedantic)
|
||||||
|
|
||||||
|
// We use long long, variadic macros and empty macro arguments (which are a
|
||||||
|
// C99 extension) even in C++98 builds.
|
||||||
|
#if __cplusplus < 201103L
|
||||||
|
CLANG_TURN_OFF(c++11-long-long)
|
||||||
|
CLANG_TURN_OFF(variadic-macros)
|
||||||
|
CLANG_TURN_OFF(c99-extensions)
|
||||||
|
#endif
|
||||||
|
#endif // clang
|
||||||
|
|
||||||
|
|
||||||
// ANSI build hasn't been updated to work without implicit wxString encoding
|
// ANSI build hasn't been updated to work without implicit wxString encoding
|
||||||
// and never will be, as it will be removed soon anyhow. And in UTF-8-only
|
// and never will be, as it will be removed soon anyhow. And in UTF-8-only
|
||||||
// build we actually want to use implicit encoding (UTF-8).
|
// build we actually want to use implicit encoding (UTF-8).
|
||||||
|
|||||||
Reference in New Issue
Block a user