Unverified Commit 64873fb5 by Viktor Kirilov Committed by GitHub

Merge branch 'develop' into doctest

parents b4def6dc b21c04c9
...@@ -23,8 +23,7 @@ option(JSON_MultipleHeaders "Use non-amalgamated version of the library." OFF) ...@@ -23,8 +23,7 @@ option(JSON_MultipleHeaders "Use non-amalgamated version of the library." OFF)
## CONFIGURATION ## CONFIGURATION
## ##
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME}) set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}" set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}" CACHE INTERNAL "")
CACHE INTERNAL "")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include") set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include")
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets") set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE "cmake/config.cmake.in") set(NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE "cmake/config.cmake.in")
...@@ -47,7 +46,7 @@ endif() ...@@ -47,7 +46,7 @@ endif()
## ##
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE) add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME}) add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})
if (${CMAKE_VERSION} VERSION_LESS "3.8.0") if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_range_for) target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_range_for)
else() else()
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11) target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
......
...@@ -13,15 +13,16 @@ template <typename It, typename = void> ...@@ -13,15 +13,16 @@ template <typename It, typename = void>
struct iterator_types {}; struct iterator_types {};
template <typename It> template <typename It>
struct iterator_types< struct iterator_types <
It, It,
void_t<typename It::difference_type, typename It::value_type, typename It::pointer, void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
typename It::reference, typename It::iterator_category>> { typename It::reference, typename It::iterator_category >>
using difference_type = typename It::difference_type; {
using value_type = typename It::value_type; using difference_type = typename It::difference_type;
using pointer = typename It::pointer; using value_type = typename It::value_type;
using reference = typename It::reference; using pointer = typename It::pointer;
using iterator_category = typename It::iterator_category; using reference = typename It::reference;
using iterator_category = typename It::iterator_category;
}; };
// This is required as some compilers implement std::iterator_traits in a way that // This is required as some compilers implement std::iterator_traits in a way that
...@@ -32,18 +33,19 @@ struct iterator_traits ...@@ -32,18 +33,19 @@ struct iterator_traits
}; };
template <typename T> template <typename T>
struct iterator_traits<T, enable_if_t<!std::is_pointer<T>::value>> struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
: iterator_types<T> : iterator_types<T>
{ {
}; };
template <typename T> template <typename T>
struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>> { struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
using iterator_category = std::random_access_iterator_tag; {
using value_type = T; using iterator_category = std::random_access_iterator_tag;
using difference_type = ptrdiff_t; using value_type = T;
using pointer = T*; using difference_type = ptrdiff_t;
using reference = T&; using pointer = T*;
using reference = T&;
}; };
} // namespace detail } // namespace detail
} // namespace nlohmann } // namespace nlohmann
...@@ -18,6 +18,14 @@ ...@@ -18,6 +18,14 @@
#endif #endif
#endif #endif
// C++ language standard detection
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#define JSON_HAS_CPP_14
#endif
// disable float-equal warnings on GCC/clang // disable float-equal warnings on GCC/clang
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
...@@ -42,7 +50,11 @@ ...@@ -42,7 +50,11 @@
// allow for portable nodiscard warnings // allow for portable nodiscard warnings
#if defined(__has_cpp_attribute) #if defined(__has_cpp_attribute)
#if __has_cpp_attribute(nodiscard) #if __has_cpp_attribute(nodiscard)
#define JSON_NODISCARD [[nodiscard]] #if defined(__clang__) && !defined(JSON_HAS_CPP_17) // issue #1535
#define JSON_NODISCARD
#else
#define JSON_NODISCARD [[nodiscard]]
#endif
#elif __has_cpp_attribute(gnu::warn_unused_result) #elif __has_cpp_attribute(gnu::warn_unused_result)
#define JSON_NODISCARD [[gnu::warn_unused_result]] #define JSON_NODISCARD [[gnu::warn_unused_result]]
#else #else
...@@ -95,14 +107,6 @@ ...@@ -95,14 +107,6 @@
#define JSON_UNLIKELY(x) x #define JSON_UNLIKELY(x) x
#endif #endif
// C++ language standard detection
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#define JSON_HAS_CPP_14
#endif
/*! /*!
@brief macro to briefly define a mapping between an enum and JSON @brief macro to briefly define a mapping between an enum and JSON
@def NLOHMANN_JSON_SERIALIZE_ENUM @def NLOHMANN_JSON_SERIALIZE_ENUM
......
...@@ -469,6 +469,14 @@ class other_error : public exception ...@@ -469,6 +469,14 @@ class other_error : public exception
#endif #endif
#endif #endif
// C++ language standard detection
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#define JSON_HAS_CPP_14
#endif
// disable float-equal warnings on GCC/clang // disable float-equal warnings on GCC/clang
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
...@@ -493,7 +501,11 @@ class other_error : public exception ...@@ -493,7 +501,11 @@ class other_error : public exception
// allow for portable nodiscard warnings // allow for portable nodiscard warnings
#if defined(__has_cpp_attribute) #if defined(__has_cpp_attribute)
#if __has_cpp_attribute(nodiscard) #if __has_cpp_attribute(nodiscard)
#define JSON_NODISCARD [[nodiscard]] #if defined(__clang__) && !defined(JSON_HAS_CPP_17) // issue #1535
#define JSON_NODISCARD
#else
#define JSON_NODISCARD [[nodiscard]]
#endif
#elif __has_cpp_attribute(gnu::warn_unused_result) #elif __has_cpp_attribute(gnu::warn_unused_result)
#define JSON_NODISCARD [[gnu::warn_unused_result]] #define JSON_NODISCARD [[gnu::warn_unused_result]]
#else #else
...@@ -546,14 +558,6 @@ class other_error : public exception ...@@ -546,14 +558,6 @@ class other_error : public exception
#define JSON_UNLIKELY(x) x #define JSON_UNLIKELY(x) x
#endif #endif
// C++ language standard detection
#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
#define JSON_HAS_CPP_17
#define JSON_HAS_CPP_14
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
#define JSON_HAS_CPP_14
#endif
/*! /*!
@brief macro to briefly define a mapping between an enum and JSON @brief macro to briefly define a mapping between an enum and JSON
@def NLOHMANN_JSON_SERIALIZE_ENUM @def NLOHMANN_JSON_SERIALIZE_ENUM
......
...@@ -6,7 +6,7 @@ option(JSON_Coverage "Build test suite with coverage information" OFF) ...@@ -6,7 +6,7 @@ option(JSON_Coverage "Build test suite with coverage information" OFF)
if(JSON_Sanitizer) if(JSON_Sanitizer)
message(STATUS "Building test suite with Clang sanitizer") message(STATUS "Building test suite with Clang sanitizer")
if(NOT MSVC) if(NOT MSVC)
set(CMAKE_CXX_FLAGS "-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "-g -O2 -fsanitize=address -fsanitize=undefined -fsanitize=integer -fsanitize=nullability -fno-omit-frame-pointer")
endif() endif()
endif() endif()
...@@ -64,7 +64,6 @@ set_target_properties(doctest_main PROPERTIES ...@@ -64,7 +64,6 @@ set_target_properties(doctest_main PROPERTIES
COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>" COMPILE_DEFINITIONS "$<$<CXX_COMPILER_ID:MSVC>:_SCL_SECURE_NO_WARNINGS>"
COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>" COMPILE_OPTIONS "$<$<CXX_COMPILER_ID:MSVC>:/EHsc;$<$<CONFIG:Release>:/Od>>"
) )
if (${CMAKE_VERSION} VERSION_LESS "3.8.0") if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
target_compile_features(doctest_main PUBLIC cxx_range_for) target_compile_features(doctest_main PUBLIC cxx_range_for)
else() else()
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
#!/bin/sh
wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/cpplint.py
wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/LICENSE
wget -N https://raw.githubusercontent.com/cpplint/cpplint/master/README.rst
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment