Fixed clang pragma and replaced with DOCTEST version

This commit is contained in:
James Moore 2020-01-12 12:37:42 +00:00
parent ed104d547f
commit 1a23a9fd4a
13 changed files with 16 additions and 56 deletions

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
namespace
{
// special test case to check if memory is leaked if constructor throws

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
TEST_CASE("const_iterator class")
{
SECTION("construction")

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
TEST_CASE("iterator class")
{
SECTION("construction")

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
namespace
{
// shortcut to scan a string literal

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
#include <valarray>
namespace

View File

@ -29,17 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
#include <deque>
#include <forward_list>
#include <fstream>

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
#include <sstream>
namespace

View File

@ -29,16 +29,14 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
#include <deque>
#include <forward_list>
#include <list>

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
TEST_CASE("iterators 1")
{
SECTION("basic behavior")

View File

@ -29,16 +29,13 @@ SOFTWARE.
#include "doctest_compatibility.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
TEST_CASE("JSON pointers")
{
SECTION("errors")

View File

@ -31,6 +31,8 @@ SOFTWARE.
#include <nlohmann/json.hpp>
DOCTEST_CLANG_SUPPRESS_WARNING("-Wunneeded-internal-declaration")
using nlohmann::json;
namespace
@ -42,17 +44,12 @@ enum test
struct pod {};
struct pod_bis {};
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
void to_json(json&, pod) noexcept{}
void to_json(json&, pod_bis){}
void from_json(const json&, pod) noexcept{}
void from_json(const json&, pod_bis){}
static json j;
#pragma clang diagnostic pop
static_assert(noexcept(json{}), "");
static_assert(noexcept(nlohmann::to_json(j, 2)), "");
static_assert(noexcept(nlohmann::to_json(j, 2.5)), "");

View File

@ -29,20 +29,16 @@ SOFTWARE.
#include "doctest_compatibility.h"
DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
// for some reason including this after the json header leads to linker errors with VS 2017...
#include <locale>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
#include <fstream>
#include <sstream>
#include <list>

View File

@ -29,19 +29,16 @@ SOFTWARE.
#include "doctest_compatibility.h"
DOCTEST_CLANG_SUPPRESS_WARNING("-Wkeyword-macro")
// for some reason including this after the json header leads to linker errors with VS 2017...
#include <locale>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wkeyword-macro"
#define private public
#include <nlohmann/json.hpp>
using nlohmann::json;
#undef private
#pragma clang diagnostic pop
#include <fstream>
#include <sstream>
#include <iostream>