MSVC warning fixes in tests
- only use "#pragma GCC" on GCC-compatible compilers
- suppress deprecation warnings also on MSVC
diff --git a/src/jsontestrunner/main.cpp b/src/jsontestrunner/main.cpp
index d24d7cf..531f541 100644
--- a/src/jsontestrunner/main.cpp
+++ b/src/jsontestrunner/main.cpp
@@ -3,8 +3,12 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning(disable : 4996)
+#endif
/* This executable is used for testing parser/writer using real JSON files.
*/
@@ -14,10 +18,6 @@
#include <sstream>
#include <stdio.h>
-#if defined(_MSC_VER) && _MSC_VER >= 1310
-#pragma warning(disable : 4996) // disable fopen deprecation warning
-#endif
-
struct Options
{
JSONCPP_STRING path;
@@ -328,4 +328,6 @@
}
}
+#if defined(__GNUC__)
#pragma GCC diagnostic pop
+#endif
diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp
index 26e01cd..3bbe896 100644
--- a/src/test_lib_json/main.cpp
+++ b/src/test_lib_json/main.cpp
@@ -3,8 +3,12 @@
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
+#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(_MSC_VER)
+#pragma warning(disable : 4996)
+#endif
#include "jsontest.h"
#include <json/config.h>
@@ -2591,4 +2595,6 @@
return runner.runCommandLine(argc, argv);
}
+#if defined(__GNUC__)
#pragma GCC diagnostic pop
+#endif