mirror of
https://github.com/nlohmann/json.git
synced 2026-02-18 02:32:24 +00:00
🚨 add new CI and fix warnings (#2561)
* ⚗️ move CI targets to CMake * ♻️ add target for cpplint * ♻️ add target for self-contained binaries * ♻️ add targets for iwyu and infer * 🔊 add version output * ♻️ add target for oclint * 🚨 fix warnings * ♻️ rename targets * ♻️ use iwyu properly * 🚨 fix warnings * ♻️ use iwyu properly * ♻️ add target for benchmarks * ♻️ add target for CMake flags * 👷 use GitHub Actions * ⚗️ try to install Clang 11 * ⚗️ try to install GCC 11 * ⚗️ try to install Clang 11 * ⚗️ try to install GCC 11 * ⚗️ add clang analyze target * 🔥 remove Google Benchmark * ⬆️ Google Benchmark 1.5.2 * 🔥 use fetchcontent * 🐧 add target to download a Linux version of CMake * 🔨 fix dependency * 🚨 fix includes * 🚨 fix comment * 🔧 adjust flags for GCC 11.0.0 20210110 (experimental) * 🐳 user Docker image to run CI * 🔧 add target for Valgrind * 👷 add target for Valgrind tests * ⚗️ add Dart * ⏪ remove Dart * ⚗️ do not call ctest in test subdirectory * ⚗️ download test data explicitly * ⚗️ only execute Valgrind tests * ⚗️ fix labels * 🔥 remove unneeded jobs * 🔨 cleanup * 🐛 fix OCLint call * ✅ add targets for offline and git-independent tests * ✅ add targets for C++ language versions and reproducible tests * 🔨 clean up * 👷 add CI steps for cppcheck and cpplint * 🚨 fix warnings from Clang-Tidy * 👷 add CI steps for Clang-Tidy * 🚨 fix warnings * 🔧 select proper binary * 🚨 fix warnings * 🚨 suppress some unhelpful warnings * 🚨 fix warnings * 🎨 fix format * 🚨 fix warnings * 👷 add CI steps for Sanitizers * 🚨 fix warnings * ⚡ add optimization to sanitizer build * 🚨 fix warnings * 🚨 add missing header * 🚨 fix warnings * 👷 add CI step for coverage * 👷 add CI steps for disabled exceptions and implicit conversions * 🚨 fix warnings * 👷 add CI steps for checking indentation * 🐛 fix variable use * 💚 fix build * ➖ remove CircleCI * 👷 add CI step for diagnostics * 🚨 fix warning * 🔥 clean Travis
This commit is contained in:
@@ -40,12 +40,12 @@ template<class T>
|
||||
struct bad_allocator : std::allocator<T>
|
||||
{
|
||||
template<class... Args>
|
||||
void construct(T*, Args&& ...)
|
||||
void construct(T* /*unused*/, Args&& ... /*unused*/)
|
||||
{
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("bad_alloc")
|
||||
{
|
||||
@@ -85,10 +85,8 @@ struct my_allocator : std::allocator<T>
|
||||
next_construct_fails = false;
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
else
|
||||
{
|
||||
::new (reinterpret_cast<void*>(p)) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
::new (reinterpret_cast<void*>(p)) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
void deallocate(T* p, std::size_t n)
|
||||
@@ -98,10 +96,8 @@ struct my_allocator : std::allocator<T>
|
||||
next_deallocate_fails = false;
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::allocator<T>::deallocate(p, n);
|
||||
}
|
||||
|
||||
std::allocator<T>::deallocate(p, n);
|
||||
}
|
||||
|
||||
void destroy(T* p)
|
||||
@@ -111,10 +107,8 @@ struct my_allocator : std::allocator<T>
|
||||
next_destroy_fails = false;
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
else
|
||||
{
|
||||
p->~T();
|
||||
}
|
||||
|
||||
p->~T();
|
||||
}
|
||||
|
||||
template <class U>
|
||||
@@ -133,7 +127,7 @@ void my_allocator_clean_up(T* p)
|
||||
alloc.destroy(p);
|
||||
alloc.deallocate(p, 1);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("controlled bad_alloc")
|
||||
{
|
||||
@@ -239,9 +233,9 @@ namespace
|
||||
template<class T>
|
||||
struct allocator_no_forward : std::allocator<T>
|
||||
{
|
||||
allocator_no_forward() {}
|
||||
allocator_no_forward() = default;
|
||||
template <class U>
|
||||
allocator_no_forward(allocator_no_forward<U>) {}
|
||||
allocator_no_forward(allocator_no_forward<U> /*unused*/) {}
|
||||
|
||||
template <class U>
|
||||
struct rebind
|
||||
@@ -256,7 +250,7 @@ struct allocator_no_forward : std::allocator<T>
|
||||
::new (static_cast<void*>(p)) T(args...);
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("bad my_allocator::construct")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user