diff --git a/Makefile b/Makefile index 9dd28947..297443a5 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,9 @@ CXX=clang++ AMALGAMATED_FILE=single_include/nlohmann/json.hpp +# directory to recent compiler binaries +COMPILER_DIR=/Users/niels/Documents/projects/compilers/local/bin + # main target all: @echo "amalgamate - amalgamate file single_include/nlohmann/json.hpp from the include/nlohmann sources" @@ -120,7 +123,7 @@ doctest: # -Wno-c++2a-compat: u8 literals will behave differently in C++20... # -Wno-padded: padding is nothing to warn about pedantic_clang: - $(MAKE) json_unit CXXFLAGS="\ + $(MAKE) json_unit CXX=$(COMPILER_DIR)/clang++ CXXFLAGS="\ -std=c++11 -Wno-c++98-compat -Wno-c++98-compat-pedantic \ -Werror \ -Weverything \ @@ -137,7 +140,7 @@ pedantic_clang: # calling GCC with most warnings pedantic_gcc: - $(MAKE) json_unit CXXFLAGS="\ + $(MAKE) json_unit CXX=$(COMPILER_DIR)/g++ CXXFLAGS="\ -std=c++11 \ -Wno-deprecated-declarations \ -Werror \ @@ -281,8 +284,8 @@ cppcheck: clang_analyze: rm -fr clang_analyze_build mkdir clang_analyze_build - cd clang_analyze_build ; CCC_CXX=/Users/niels/Documents/projects/llvm-clang/local/bin/clang++ /Users/niels/Documents/projects/llvm-clang/local/bin/scan-build cmake .. - /Users/niels/Documents/projects/llvm-clang/local/bin/scan-build -enable-checker alpha.core.DynamicTypeChecker,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.cplusplus.DeleteWithNonVirtualDtor,alpha.cplusplus.IteratorRange,alpha.cplusplus.MisusedMovedObject,alpha.security.ArrayBoundV2,alpha.core.Conversion --use-c++=/Users/niels/Documents/projects/llvm-clang/local/bin/clang++ --view -analyze-headers -o clang_analyze_build/report.html make -j10 -C clang_analyze_build + cd clang_analyze_build ; CCC_CXX=$(COMPILER_DIR)/clang++ CXX=$(COMPILER_DIR)/clang++ $(COMPILER_DIR)/scan-build cmake .. -GNinja + cd clang_analyze_build ; $(COMPILER_DIR)/scan-build -enable-checker alpha.core.BoolAssignment,alpha.core.CallAndMessageUnInitRefArg,alpha.core.CastSize,alpha.core.CastToStruct,alpha.core.Conversion,alpha.core.DynamicTypeChecker,alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.core.SizeofPtr,alpha.core.StackAddressAsyncEscape,alpha.core.TestAfterDivZero,alpha.deadcode.UnreachableCode,core.builtin.BuiltinFunctions,core.builtin.NoReturnFunctions,core.CallAndMessage,core.DivideZero,core.DynamicTypePropagation,core.NonnilStringConstants,core.NonNullParamChecker,core.NullDereference,core.StackAddressEscape,core.UndefinedBinaryOperatorResult,core.uninitialized.ArraySubscript,core.uninitialized.Assign,core.uninitialized.Branch,core.uninitialized.CapturedBlockVariable,core.uninitialized.UndefReturn,core.VLASize,cplusplus.InnerPointer,cplusplus.Move,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,cplusplus.SelfAssignment,deadcode.DeadStores,nullability.NullableDereferenced,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull --use-c++=$(COMPILER_DIR)/clang++ --view -analyze-headers -o clang_analyze_build/report.html ninja ########################################################################## # maintainer targets @@ -315,10 +318,11 @@ check-amalgamation: # check if every header in nlohmann includes sufficient headers to be compiled # individually check-single-includes: - for x in $(SRCS); do \ + @for x in $(SRCS); do \ + echo "Checking self-sufficiency of $$x..." ; \ echo "#include <$$x>\nint main() {}\n" | sed 's|include/||' > single_include_test.cpp; \ $(CXX) $(CXXFLAGS) -Iinclude -std=c++11 single_include_test.cpp -o single_include_test; \ - rm single_include_test.cpp single_include_test; \ + rm -f single_include_test.cpp single_include_test; \ done ########################################################################## diff --git a/include/nlohmann/detail/conversions/to_chars.hpp b/include/nlohmann/detail/conversions/to_chars.hpp index b32e1766..7757c95e 100644 --- a/include/nlohmann/detail/conversions/to_chars.hpp +++ b/include/nlohmann/detail/conversions/to_chars.hpp @@ -5,6 +5,8 @@ #include // signbit, isfinite #include // intN_t, uintN_t #include // memcpy, memmove +#include // numeric_limits +#include // conditional namespace nlohmann { diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index 91215a96..8ed0a396 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -12,6 +12,7 @@ #include // pair, declval #include //FILE * +#include #include namespace nlohmann diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index 153f75d2..6801b3ca 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -1,11 +1,12 @@ #pragma once +#include #include #include #include -#include #include +#include namespace nlohmann { diff --git a/include/nlohmann/detail/iterators/iter_impl.hpp b/include/nlohmann/detail/iterators/iter_impl.hpp index 81a5e0d7..04d7cacb 100644 --- a/include/nlohmann/detail/iterators/iter_impl.hpp +++ b/include/nlohmann/detail/iterators/iter_impl.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace nlohmann diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index 87daa93c..3521b889 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -1,5 +1,6 @@ #pragma once +#include // all_of #include // assert #include // accumulate #include // string diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 228f99ea..2e8aac5e 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2152,6 +2152,8 @@ constexpr const auto& to_json = detail::static_const::value; #include // pair, declval #include //FILE * +// #include + // #include @@ -4236,14 +4238,15 @@ struct is_sax_static_asserts // #include +#include #include #include #include -// #include - // #include +// #include + namespace nlohmann { @@ -5598,6 +5601,8 @@ template struct internal_iterator // #include +// #include + // #include @@ -9805,6 +9810,8 @@ class binary_writer #include // signbit, isfinite #include // intN_t, uintN_t #include // memcpy, memmove +#include // numeric_limits +#include // conditional namespace nlohmann { @@ -11778,6 +11785,7 @@ class json_ref // #include +#include // all_of #include // assert #include // accumulate #include // string