MSVC warning fixes in tests

- only use "#pragma GCC" on GCC-compatible compilers
- suppress deprecation warnings also on MSVC
This commit is contained in:
Marcel Raad 2017-11-10 10:58:43 +01:00
parent d61cddedac
commit 240c85a10c
No known key found for this signature in database
GPG Key ID: 33C416EFAE4D6F02
2 changed files with 12 additions and 4 deletions

View File

@ -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 @@ int main(int argc, const char* argv[]) {
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@ -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 @@ int main(int argc, const char* argv[]) {
return runner.runCommandLine(argc, argv);
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif