Overwork astyle call (#4573)
* 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * Use ubuntu-latest image to run Valgrind (#4575) * 🔧 use Clang image to run valgrind * 🔧 use Clang image to run valgrind * 🔧 use Clang image to run valgrind * 🔧 use Ubuntu image to run valgrind * Use Clang image to run iwyu (#4574) * 🔧 use Clang image to run iwyu * 🔧 use Clang image to run iwyu * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🔧 overwork astyle call * 🎨 format code * 🔨 clean up
This commit is contained in:
parent
0fa326a8e8
commit
6057b31df7
@ -1,84 +0,0 @@
|
||||
#AccessModifierOffset: 2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
#AlignConsecutiveBitFields: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros: false
|
||||
AlignEscapedNewlines: Right
|
||||
#AlignOperands: AlignAfterOperator
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
#AllowShortEnumsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
#BitFieldColonSpacing: Both
|
||||
BreakBeforeBraces: Custom # or Allman
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
#BeforeLambdaBody: false
|
||||
#BeforeWhile: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 0
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 2
|
||||
Cpp11BracedListStyle: true
|
||||
PointerAlignment: Left
|
||||
FixNamespaceComments: true
|
||||
IncludeBlocks: Preserve
|
||||
#IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: BeforeHash
|
||||
IndentWidth: 4
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ReflowComments: false
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++11
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@ -10,6 +10,11 @@ updates:
|
||||
schedule:
|
||||
interval: daily
|
||||
|
||||
- package-ecosystem: pip
|
||||
directory: /tools/astyle
|
||||
schedule:
|
||||
interval: daily
|
||||
|
||||
- package-ecosystem: pip
|
||||
directory: /tools/serve_header
|
||||
schedule:
|
||||
|
||||
13
.github/workflows/check_amalgamation.yml
vendored
13
.github/workflows/check_amalgamation.yml
vendored
@ -31,11 +31,6 @@ jobs:
|
||||
MAIN_DIR: ${{ github.workspace }}/main
|
||||
INCLUDE_DIR: ${{ github.workspace }}/main/single_include/nlohmann
|
||||
TOOL_DIR: ${{ github.workspace }}/tools/tools/amalgamate
|
||||
ASTYLE_FLAGS: >
|
||||
--style=allman --indent=spaces=4 --indent-modifiers --indent-switches --indent-preproc-block
|
||||
--indent-preproc-define --indent-col1-comments --pad-oper --pad-header --align-pointer=type
|
||||
--align-reference=type --add-brackets --convert-tabs --close-templates --lineend=linux --preserve-date
|
||||
--formatted
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
@ -57,8 +52,8 @@ jobs:
|
||||
|
||||
- name: Install astyle
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install astyle
|
||||
python3 -mvenv venv
|
||||
venv/bin/pip3 install -r $MAIN_DIR/tools/astyle/requirements.txt
|
||||
|
||||
- name: Check amalgamation
|
||||
run: |
|
||||
@ -71,11 +66,11 @@ jobs:
|
||||
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json.json -s .
|
||||
python3 $TOOL_DIR/amalgamate.py -c $TOOL_DIR/config_json_fwd.json -s .
|
||||
echo "Format (1)"
|
||||
astyle $ASTYLE_FLAGS --suffix=none --quiet $INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
|
||||
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=none --quiet $INCLUDE_DIR/json.hpp $INCLUDE_DIR/json_fwd.hpp
|
||||
|
||||
diff $INCLUDE_DIR/json.hpp~ $INCLUDE_DIR/json.hpp
|
||||
diff $INCLUDE_DIR/json_fwd.hpp~ $INCLUDE_DIR/json_fwd.hpp
|
||||
|
||||
astyle $ASTYLE_FLAGS $(find docs/examples include tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
||||
${{ github.workspace }}/venv/bin/astyle --project=tools/astyle/.astylerc --suffix=orig $(find docs/examples include tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
||||
echo Check
|
||||
find $MAIN_DIR -name '*.orig' -exec false {} \+
|
||||
|
||||
12
.github/workflows/ubuntu.yml
vendored
12
.github/workflows/ubuntu.yml
vendored
@ -43,21 +43,15 @@ jobs:
|
||||
- name: Build
|
||||
run: cmake --build build --target ci_test_gcc
|
||||
|
||||
ci_static_analysis:
|
||||
ci_infer:
|
||||
runs-on: ubuntu-latest
|
||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||
strategy:
|
||||
matrix:
|
||||
target: [
|
||||
ci_test_amalgamation, # needs AStyle
|
||||
ci_infer # needs Infer
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Run CMake
|
||||
run: cmake -S . -B build -DJSON_CI=On
|
||||
- name: Build
|
||||
run: cmake --build build --target ${{ matrix.target }}
|
||||
run: cmake --build build --target ci_infer
|
||||
|
||||
ci_test_single_header:
|
||||
runs-on: ubuntu-latest
|
||||
@ -75,7 +69,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
target: [ci_cppcheck, ci_cpplint, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_reuse_compliance, ci_test_valgrind]
|
||||
target: [ci_test_amalgamation, ci_cppcheck, ci_cpplint, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_reuse_compliance, ci_test_valgrind]
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -41,4 +41,6 @@
|
||||
/serve_header.yml
|
||||
|
||||
# Swift Package Manager build directory
|
||||
/.build
|
||||
/.build
|
||||
|
||||
/tools/astyle/venv/
|
||||
|
||||
30
Makefile
30
Makefile
@ -142,28 +142,16 @@ pvs_studio:
|
||||
# Code format and source amalgamation
|
||||
##########################################################################
|
||||
|
||||
ASTYLE=tools/astyle/venv/bin/astyle
|
||||
|
||||
install_astyle:
|
||||
@test -d tools/astyle/venv || python3 -mvenv tools/astyle/venv ; tools/astyle/venv/bin/pip3 install --quiet --upgrade pip
|
||||
@test -f $(ASTYLE) || tools/astyle/venv/bin/pip3 install --quiet -r tools/astyle/requirements.txt
|
||||
@$(ASTYLE) --version
|
||||
|
||||
# call the Artistic Style pretty printer on all source files
|
||||
pretty:
|
||||
astyle \
|
||||
--style=allman \
|
||||
--indent=spaces=4 \
|
||||
--indent-modifiers \
|
||||
--indent-switches \
|
||||
--indent-preproc-block \
|
||||
--indent-preproc-define \
|
||||
--indent-col1-comments \
|
||||
--pad-oper \
|
||||
--pad-header \
|
||||
--align-pointer=type \
|
||||
--align-reference=type \
|
||||
--add-braces \
|
||||
--convert-tabs \
|
||||
--close-templates \
|
||||
--lineend=linux \
|
||||
--preserve-date \
|
||||
--suffix=none \
|
||||
--formatted \
|
||||
$(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) docs/examples/*.cpp
|
||||
pretty: install_astyle
|
||||
$(ASTYLE) --project=tools/astyle/.astylerc $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) docs/examples/*.cpp
|
||||
|
||||
# call the Clang-Format on all source files
|
||||
pretty_format:
|
||||
|
||||
@ -8,11 +8,6 @@ set(N 10)
|
||||
include(FindPython3)
|
||||
find_package(Python3 COMPONENTS Interpreter)
|
||||
|
||||
find_program(ASTYLE_TOOL NAMES astyle)
|
||||
execute_process(COMMAND ${ASTYLE_TOOL} --version OUTPUT_VARIABLE ASTYLE_TOOL_VERSION ERROR_VARIABLE ASTYLE_TOOL_VERSION)
|
||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" ASTYLE_TOOL_VERSION "${ASTYLE_TOOL_VERSION}")
|
||||
message(STATUS "🔖 Artistic Style ${ASTYLE_TOOL_VERSION} (${ASTYLE_TOOL})")
|
||||
|
||||
find_program(CLANG_TOOL NAMES clang++-HEAD clang++ clang++-20 clang++-19 clang++-18 clang++-17 clang++-16 clang++-15 clang++-14 clang++-13 clang++-12 clang++-11 clang++)
|
||||
execute_process(COMMAND ${CLANG_TOOL} --version OUTPUT_VARIABLE CLANG_TOOL_VERSION ERROR_VARIABLE CLANG_TOOL_VERSION)
|
||||
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CLANG_TOOL_VERSION "${CLANG_TOOL_VERSION}")
|
||||
@ -632,8 +627,6 @@ add_custom_target(ci_test_clang_sanitizer
|
||||
# Check if header is amalgamated and sources are properly indented.
|
||||
###############################################################################
|
||||
|
||||
set(ASTYLE_FLAGS --style=allman --indent=spaces=4 --indent-modifiers --indent-switches --indent-preproc-block --indent-preproc-define --indent-col1-comments --pad-oper --pad-header --align-pointer=type --align-reference=type --add-brackets --convert-tabs --close-templates --lineend=linux --preserve-date --formatted)
|
||||
|
||||
file(GLOB_RECURSE INDENT_FILES
|
||||
${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/tests/src/*.cpp
|
||||
@ -649,14 +642,18 @@ add_custom_target(ci_test_amalgamation
|
||||
COMMAND cp ${include_dir}/json.hpp ${include_dir}/json.hpp~
|
||||
COMMAND cp ${include_dir}/json_fwd.hpp ${include_dir}/json_fwd.hpp~
|
||||
|
||||
COMMAND ${Python3_EXECUTABLE} -mvenv venv_astyle
|
||||
COMMAND venv_astyle/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/tools/astyle/requirements.txt
|
||||
COMMAND venv_astyle/bin/astyle --version
|
||||
|
||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json.json -s .
|
||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json_fwd.json -s .
|
||||
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} --suffix=none --quiet ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp
|
||||
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=none ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp
|
||||
|
||||
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
||||
COMMAND diff ${include_dir}/json_fwd.hpp~ ${include_dir}/json_fwd.hpp
|
||||
|
||||
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} ${INDENT_FILES}
|
||||
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=orig ${INDENT_FILES}
|
||||
COMMAND for FILE in `find . -name '*.orig'`\; do false \; done
|
||||
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
||||
@ -79,8 +79,8 @@ int main()
|
||||
|
||||
// visit and output
|
||||
j.visit(
|
||||
[&](const json::json_pointer & p,
|
||||
const json & j)
|
||||
[&](const json::json_pointer & p,
|
||||
const json & j)
|
||||
{
|
||||
std::cout << (p.empty() ? std::string{"/"} : p.to_string())
|
||||
<< " - metadata = " << j.metadata << " -> " << j.dump() << '\n';
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
#include <utility> // pair, declval
|
||||
#include <valarray> // valarray
|
||||
|
||||
|
||||
#include <nlohmann/detail/exceptions.hpp>
|
||||
#include <nlohmann/detail/macro_scope.hpp>
|
||||
#include <nlohmann/detail/meta/cpp_future.hpp>
|
||||
@ -345,7 +344,7 @@ void())
|
||||
|
||||
template < typename BasicJsonType, typename T, std::size_t... Idx >
|
||||
std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j,
|
||||
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
|
||||
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
|
||||
{
|
||||
return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ namespace std
|
||||
#endif
|
||||
template<typename IteratorType>
|
||||
class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp)
|
||||
: public std::integral_constant<std::size_t, 2> {};
|
||||
: public std::integral_constant<std::size_t, 2> {};
|
||||
|
||||
template<std::size_t N, typename IteratorType>
|
||||
class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp)
|
||||
|
||||
@ -43,7 +43,7 @@ struct iterator_traits
|
||||
|
||||
template<typename T>
|
||||
struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
|
||||
: iterator_types<T>
|
||||
: iterator_types<T>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
@ -261,19 +261,19 @@ struct is_default_constructible : std::is_default_constructible<T> {};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct is_default_constructible<std::pair<T1, T2>>
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct is_default_constructible<const std::pair<T1, T2>>
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
|
||||
template <typename... Ts>
|
||||
struct is_default_constructible<std::tuple<Ts...>>
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
|
||||
template <typename... Ts>
|
||||
struct is_default_constructible<const std::tuple<Ts...>>
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
struct is_constructible : std::is_constructible<T, Args...> {};
|
||||
@ -471,8 +471,8 @@ is_detected<range_value_t, ConstructibleArrayType>::value&&
|
||||
// special case for types like std::filesystem::path whose iterator's value_type are themselves
|
||||
// c.f. https://github.com/nlohmann/json/pull/3073
|
||||
!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&&
|
||||
is_complete_type <
|
||||
detected_t<range_value_t, ConstructibleArrayType >>::value >>
|
||||
is_complete_type <
|
||||
detected_t<range_value_t, ConstructibleArrayType >>::value >>
|
||||
{
|
||||
using value_type = range_value_t<ConstructibleArrayType>;
|
||||
|
||||
@ -595,12 +595,12 @@ using is_usable_as_key_type = typename std::conditional <
|
||||
template<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true,
|
||||
bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>>
|
||||
using is_usable_as_basic_json_key_type = typename std::conditional <
|
||||
is_usable_as_key_type<typename BasicJsonType::object_comparator_t,
|
||||
typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
|
||||
RequireTransparentComparator, ExcludeObjectKeyType>::value
|
||||
&& !is_json_iterator_of<BasicJsonType, KeyType>::value,
|
||||
std::true_type,
|
||||
std::false_type >::type;
|
||||
is_usable_as_key_type<typename BasicJsonType::object_comparator_t,
|
||||
typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
|
||||
RequireTransparentComparator, ExcludeObjectKeyType>::value
|
||||
&& !is_json_iterator_of<BasicJsonType, KeyType>::value,
|
||||
std::true_type,
|
||||
std::false_type >::type;
|
||||
|
||||
template<typename ObjectType, typename KeyType>
|
||||
using detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>()));
|
||||
|
||||
@ -138,7 +138,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
)
|
||||
{
|
||||
return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
|
||||
std::move(cb), allow_exceptions, ignore_comments);
|
||||
std::move(cb), allow_exceptions, ignore_comments);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -26,7 +26,7 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
/// for use within nlohmann::basic_json<ordered_map>
|
||||
template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
class Allocator = std::allocator<std::pair<const Key, T>>>
|
||||
struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
|
||||
struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
|
||||
{
|
||||
using key_type = Key;
|
||||
using mapped_type = T;
|
||||
@ -341,7 +341,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
|
||||
template<typename InputIt>
|
||||
using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
|
||||
std::input_iterator_tag>::value>::type;
|
||||
std::input_iterator_tag>::value>::type;
|
||||
|
||||
template<typename InputIt, typename = require_input_iter<InputIt>>
|
||||
void insert(InputIt first, InputIt last)
|
||||
|
||||
@ -183,7 +183,6 @@
|
||||
#include <utility> // pair, declval
|
||||
#include <valarray> // valarray
|
||||
|
||||
|
||||
// #include <nlohmann/detail/exceptions.hpp>
|
||||
// __ _____ _____ _____
|
||||
// __| | __| | | | JSON for Modern C++
|
||||
@ -3344,7 +3343,7 @@ struct iterator_traits
|
||||
|
||||
template<typename T>
|
||||
struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
|
||||
: iterator_types<T>
|
||||
: iterator_types<T>
|
||||
{
|
||||
};
|
||||
|
||||
@ -3725,19 +3724,19 @@ struct is_default_constructible : std::is_default_constructible<T> {};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct is_default_constructible<std::pair<T1, T2>>
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct is_default_constructible<const std::pair<T1, T2>>
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
: conjunction<is_default_constructible<T1>, is_default_constructible<T2>> {};
|
||||
|
||||
template <typename... Ts>
|
||||
struct is_default_constructible<std::tuple<Ts...>>
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
|
||||
template <typename... Ts>
|
||||
struct is_default_constructible<const std::tuple<Ts...>>
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
: conjunction<is_default_constructible<Ts>...> {};
|
||||
|
||||
template <typename T, typename... Args>
|
||||
struct is_constructible : std::is_constructible<T, Args...> {};
|
||||
@ -3935,8 +3934,8 @@ is_detected<range_value_t, ConstructibleArrayType>::value&&
|
||||
// special case for types like std::filesystem::path whose iterator's value_type are themselves
|
||||
// c.f. https://github.com/nlohmann/json/pull/3073
|
||||
!std::is_same<ConstructibleArrayType, detected_t<range_value_t, ConstructibleArrayType>>::value&&
|
||||
is_complete_type <
|
||||
detected_t<range_value_t, ConstructibleArrayType >>::value >>
|
||||
is_complete_type <
|
||||
detected_t<range_value_t, ConstructibleArrayType >>::value >>
|
||||
{
|
||||
using value_type = range_value_t<ConstructibleArrayType>;
|
||||
|
||||
@ -4059,12 +4058,12 @@ using is_usable_as_key_type = typename std::conditional <
|
||||
template<typename BasicJsonType, typename KeyTypeCVRef, bool RequireTransparentComparator = true,
|
||||
bool ExcludeObjectKeyType = RequireTransparentComparator, typename KeyType = uncvref_t<KeyTypeCVRef>>
|
||||
using is_usable_as_basic_json_key_type = typename std::conditional <
|
||||
is_usable_as_key_type<typename BasicJsonType::object_comparator_t,
|
||||
typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
|
||||
RequireTransparentComparator, ExcludeObjectKeyType>::value
|
||||
&& !is_json_iterator_of<BasicJsonType, KeyType>::value,
|
||||
std::true_type,
|
||||
std::false_type >::type;
|
||||
is_usable_as_key_type<typename BasicJsonType::object_comparator_t,
|
||||
typename BasicJsonType::object_t::key_type, KeyTypeCVRef,
|
||||
RequireTransparentComparator, ExcludeObjectKeyType>::value
|
||||
&& !is_json_iterator_of<BasicJsonType, KeyType>::value,
|
||||
std::true_type,
|
||||
std::false_type >::type;
|
||||
|
||||
template<typename ObjectType, typename KeyType>
|
||||
using detect_erase_with_key_type = decltype(std::declval<ObjectType&>().erase(std::declval<KeyType>()));
|
||||
@ -5035,7 +5034,7 @@ void())
|
||||
|
||||
template < typename BasicJsonType, typename T, std::size_t... Idx >
|
||||
std::array<T, sizeof...(Idx)> from_json_inplace_array_impl(BasicJsonType&& j,
|
||||
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
|
||||
identity_tag<std::array<T, sizeof...(Idx)>> /*unused*/, index_sequence<Idx...> /*unused*/)
|
||||
{
|
||||
return { { std::forward<BasicJsonType>(j).at(Idx).template get<T>()... } };
|
||||
}
|
||||
@ -5540,7 +5539,7 @@ namespace std
|
||||
#endif
|
||||
template<typename IteratorType>
|
||||
class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp)
|
||||
: public std::integral_constant<std::size_t, 2> {};
|
||||
: public std::integral_constant<std::size_t, 2> {};
|
||||
|
||||
template<std::size_t N, typename IteratorType>
|
||||
class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp)
|
||||
@ -19585,7 +19584,7 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
/// for use within nlohmann::basic_json<ordered_map>
|
||||
template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
class Allocator = std::allocator<std::pair<const Key, T>>>
|
||||
struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
|
||||
struct ordered_map : std::vector<std::pair<const Key, T>, Allocator>
|
||||
{
|
||||
using key_type = Key;
|
||||
using mapped_type = T;
|
||||
@ -19900,7 +19899,7 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
|
||||
|
||||
template<typename InputIt>
|
||||
using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category,
|
||||
std::input_iterator_tag>::value>::type;
|
||||
std::input_iterator_tag>::value>::type;
|
||||
|
||||
template<typename InputIt, typename = require_input_iter<InputIt>>
|
||||
void insert(InputIt first, InputIt last)
|
||||
@ -19994,7 +19993,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
)
|
||||
{
|
||||
return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter),
|
||||
std::move(cb), allow_exceptions, ignore_comments);
|
||||
std::move(cb), allow_exceptions, ignore_comments);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -20690,8 +20689,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
detail::enable_if_t <
|
||||
!detail::is_basic_json<U>::value && detail::is_compatible_type<basic_json_t, U>::value, int > = 0 >
|
||||
basic_json(CompatibleType && val) noexcept(noexcept( // NOLINT(bugprone-forwarding-reference-overload,bugprone-exception-escape)
|
||||
JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
|
||||
std::forward<CompatibleType>(val))))
|
||||
JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
|
||||
std::forward<CompatibleType>(val))))
|
||||
{
|
||||
JSONSerializer<U>::to_json(*this, std::forward<CompatibleType>(val));
|
||||
set_parents();
|
||||
@ -21485,7 +21484,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
detail::has_from_json<basic_json_t, ValueType>::value,
|
||||
int > = 0 >
|
||||
ValueType get_impl(detail::priority_tag<0> /*unused*/) const noexcept(noexcept(
|
||||
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
|
||||
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
|
||||
{
|
||||
auto ret = ValueType();
|
||||
JSONSerializer<ValueType>::from_json(*this, ret);
|
||||
@ -21527,7 +21526,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
detail::has_non_default_from_json<basic_json_t, ValueType>::value,
|
||||
int > = 0 >
|
||||
ValueType get_impl(detail::priority_tag<1> /*unused*/) const noexcept(noexcept(
|
||||
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
|
||||
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
|
||||
{
|
||||
return JSONSerializer<ValueType>::from_json(*this);
|
||||
}
|
||||
@ -21677,7 +21676,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
detail::has_from_json<basic_json_t, ValueType>::value,
|
||||
int > = 0 >
|
||||
ValueType & get_to(ValueType& v) const noexcept(noexcept(
|
||||
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))
|
||||
JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))
|
||||
{
|
||||
JSONSerializer<ValueType>::from_json(*this, v);
|
||||
return v;
|
||||
|
||||
@ -343,13 +343,13 @@ TEST_CASE("alternative string type")
|
||||
|
||||
CHECK_NOTHROW(doc1.patch(patch1));
|
||||
alt_json doc1_ans = alt_json::parse(R"(
|
||||
{
|
||||
"a": {
|
||||
"foo": 1,
|
||||
"b": [ "foo", "bar" ]
|
||||
}
|
||||
}
|
||||
)");
|
||||
{
|
||||
"a": {
|
||||
"foo": 1,
|
||||
"b": [ "foo", "bar" ]
|
||||
}
|
||||
}
|
||||
)");
|
||||
CHECK(doc1.patch(patch1) == doc1_ans);
|
||||
}
|
||||
|
||||
|
||||
@ -339,13 +339,13 @@ TEST_CASE("BJData")
|
||||
std::vector<int32_t> const numbers
|
||||
{
|
||||
-32769,
|
||||
-100000,
|
||||
-1000000,
|
||||
-10000000,
|
||||
-100000000,
|
||||
-1000000000,
|
||||
-2147483647 - 1, // https://stackoverflow.com/a/29356002/266378
|
||||
};
|
||||
-100000,
|
||||
-1000000,
|
||||
-10000000,
|
||||
-100000000,
|
||||
-1000000000,
|
||||
-2147483647 - 1, // https://stackoverflow.com/a/29356002/266378
|
||||
};
|
||||
for (const auto i : numbers)
|
||||
{
|
||||
CAPTURE(i)
|
||||
|
||||
@ -240,13 +240,13 @@ TEST_CASE("CBOR")
|
||||
const std::vector<int64_t> numbers
|
||||
{
|
||||
-65537,
|
||||
-100000,
|
||||
-1000000,
|
||||
-10000000,
|
||||
-100000000,
|
||||
-1000000000,
|
||||
-4294967296,
|
||||
};
|
||||
-100000,
|
||||
-1000000,
|
||||
-10000000,
|
||||
-100000000,
|
||||
-1000000000,
|
||||
-4294967296,
|
||||
};
|
||||
for (const auto i : numbers)
|
||||
{
|
||||
CAPTURE(i)
|
||||
|
||||
@ -32,7 +32,6 @@ using nlohmann::json;
|
||||
#include <unordered_set>
|
||||
#include <valarray>
|
||||
|
||||
|
||||
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
|
||||
DOCTEST_CLANG_SUPPRESS_WARNING("-Wexit-time-destructors")
|
||||
@ -1658,7 +1657,6 @@ TEST_CASE("JSON to enum mapping")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef JSON_HAS_CPP_17
|
||||
#ifndef JSON_USE_IMPLICIT_CONVERSIONS
|
||||
TEST_CASE("std::optional")
|
||||
|
||||
@ -282,8 +282,8 @@ TEST_CASE("JSON Visit Node")
|
||||
};
|
||||
|
||||
json.visit(
|
||||
[&](const json_with_visitor_t::json_pointer & p,
|
||||
const json_with_visitor_t& j)
|
||||
[&](const json_with_visitor_t::json_pointer & p,
|
||||
const json_with_visitor_t& j)
|
||||
{
|
||||
std::stringstream str;
|
||||
str << p.to_string() << " - " ;
|
||||
@ -330,6 +330,6 @@ TEST_CASE("JSON Visit Node")
|
||||
CHECK(expected.count(str.str()) == 1);
|
||||
expected.erase(str.str());
|
||||
}
|
||||
);
|
||||
);
|
||||
CHECK(expected.empty());
|
||||
}
|
||||
|
||||
@ -19,7 +19,6 @@ using nlohmann::json;
|
||||
#include <sstream>
|
||||
#include <valarray>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
struct SaxEventLogger : public nlohmann::json_sax<json>
|
||||
|
||||
@ -479,11 +479,11 @@ TEST_CASE("MessagePack")
|
||||
std::vector<int32_t> const numbers
|
||||
{
|
||||
-32769,
|
||||
-65536,
|
||||
-77777,
|
||||
-1048576,
|
||||
-2147483648LL,
|
||||
};
|
||||
-65536,
|
||||
-77777,
|
||||
-1048576,
|
||||
-2147483648LL,
|
||||
};
|
||||
for (auto i : numbers)
|
||||
{
|
||||
CAPTURE(i)
|
||||
|
||||
@ -1335,10 +1335,10 @@ TEST_CASE("regression tests 1")
|
||||
{
|
||||
std::ifstream is;
|
||||
is.exceptions(
|
||||
is.exceptions()
|
||||
| std::ios_base::failbit
|
||||
| std::ios_base::badbit
|
||||
); // handle different exceptions as 'file not found', 'permission denied'
|
||||
is.exceptions()
|
||||
| std::ios_base::failbit
|
||||
| std::ios_base::badbit
|
||||
); // handle different exceptions as 'file not found', 'permission denied'
|
||||
|
||||
is.open(TEST_DATA_DIRECTORY "/regression/working_file.json");
|
||||
json _;
|
||||
@ -1348,10 +1348,10 @@ TEST_CASE("regression tests 1")
|
||||
{
|
||||
std::ifstream is;
|
||||
is.exceptions(
|
||||
is.exceptions()
|
||||
| std::ios_base::failbit
|
||||
| std::ios_base::badbit
|
||||
); // handle different exceptions as 'file not found', 'permission denied'
|
||||
is.exceptions()
|
||||
| std::ios_base::failbit
|
||||
| std::ios_base::badbit
|
||||
); // handle different exceptions as 'file not found', 'permission denied'
|
||||
|
||||
is.open(TEST_DATA_DIRECTORY "/json_nlohmann_tests/all_unicode.json.cbor",
|
||||
std::ios_base::in | std::ios_base::binary);
|
||||
|
||||
80
tools/astyle/.astylerc
Normal file
80
tools/astyle/.astylerc
Normal file
@ -0,0 +1,80 @@
|
||||
# Configuration for Artistic Style
|
||||
# see https://astyle.sourceforge.net/astyle.html
|
||||
|
||||
#######################
|
||||
# Brace Style Options #
|
||||
#######################
|
||||
|
||||
# use Allman style for braces
|
||||
--style=allman
|
||||
|
||||
###############
|
||||
# Tab Options #
|
||||
###############
|
||||
|
||||
# indent using 4 spaces
|
||||
--indent=spaces=4
|
||||
|
||||
#######################
|
||||
# Indentation Options #
|
||||
#######################
|
||||
|
||||
# indent access modifiers one half indent
|
||||
--indent-modifiers
|
||||
|
||||
# indent switch cases to the switch block
|
||||
--indent-switches
|
||||
|
||||
# indent preprocessor blocks
|
||||
--indent-preproc-block
|
||||
|
||||
# indent preprocessor defines
|
||||
--indent-preproc-define
|
||||
|
||||
# indent C++ comments
|
||||
--indent-col1-comments
|
||||
|
||||
###################
|
||||
# Padding Options #
|
||||
###################
|
||||
|
||||
# insert space padding around operators
|
||||
--pad-oper
|
||||
|
||||
# insert space between if/for/while... and the following parentheses
|
||||
--pad-header
|
||||
|
||||
# attach the pointer to the variable type (left)
|
||||
--align-pointer=type
|
||||
|
||||
# attach the reference to the variable type (left)
|
||||
--align-reference=type
|
||||
|
||||
######################
|
||||
# Formatting Options #
|
||||
######################
|
||||
|
||||
# add braces to unbraced one line conditional statements
|
||||
--add-braces
|
||||
|
||||
# convert tabs to spaces
|
||||
--convert-tabs
|
||||
|
||||
# closes whitespace between the ending angle brackets of template definitions
|
||||
--close-templates
|
||||
|
||||
#################
|
||||
# Other Options #
|
||||
#################
|
||||
|
||||
# do not create backup files
|
||||
--suffix=none
|
||||
|
||||
# preserve the original file date
|
||||
--preserve-date
|
||||
|
||||
# display only the files that have been formatted
|
||||
--formatted
|
||||
|
||||
# for the linux (LF) line end style
|
||||
--lineend=linux
|
||||
1
tools/astyle/requirements.txt
Normal file
1
tools/astyle/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
astyle==3.4.13
|
||||
Loading…
Reference in New Issue
Block a user