mirror of
https://github.com/Tencent/rapidjson.git
synced 2025-10-28 11:31:57 +01:00
Add RAPIDJSON_DIAG_* macros to handle compiler warnings
Warning push/pop support has been added to GCC in version 4.6.0, and pragmas to ignore certain warnings are present since 4.2.0. This patch hides the compiler-specific warning push/pop/disable pragmas behind a macro-based implementation (currently for MSVC and clang /GCC. This avoids warnings, as seen e.g. on GCC 4.4: ../../include/rapidjson/document.h:14: error: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’ and earlier versions complaining about unknown pragmas being ignored. Note: unittest.h and perftest.h need to check for compilers explicitly, as rapidjson.h is not included there.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
using namespace rapidjson;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
RAPIDJSON_DIAG_PUSH
|
||||
RAPIDJSON_DIAG_OFF(effc++)
|
||||
#endif
|
||||
|
||||
template<bool expect>
|
||||
@@ -707,5 +707,5 @@ TEST(Reader, Parse_IStreamWrapper_StringStream) {
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
RAPIDJSON_DIAG_POP
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user