From 0f589ceba8bb1edab89451d8a7cdad2fe15b9e88 Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Sun, 24 Oct 2021 13:21:32 +0300 Subject: [PATCH] added header bookend includes --- include/toml++/impl/array.h | 3 + include/toml++/impl/array_impl.h | 3 +- include/toml++/impl/common.h | 3 + include/toml++/impl/date_time.h | 3 + include/toml++/impl/default_formatter.h | 6 +- include/toml++/impl/default_formatter_impl.h | 7 +- include/toml++/impl/formatter.h | 10 +- include/toml++/impl/header_end.h | 6 + include/toml++/impl/header_start.h | 8 ++ include/toml++/impl/json_formatter.h | 6 +- include/toml++/impl/json_formatter_impl.h | 8 +- include/toml++/impl/node.h | 3 + include/toml++/impl/node_impl.h | 5 + include/toml++/impl/node_view.h | 4 +- include/toml++/impl/parse_error.h | 4 +- include/toml++/impl/parse_result.h | 3 + include/toml++/impl/parser.h | 3 + include/toml++/impl/parser_impl.h | 9 +- include/toml++/impl/preprocessor.h | 4 +- include/toml++/impl/print_to_stream.h | 5 +- include/toml++/impl/table.h | 3 + include/toml++/impl/table_impl.h | 3 +- include/toml++/impl/template_instantiations.h | 5 + include/toml++/impl/utf8.h | 6 +- include/toml++/impl/utf8_streams.h | 3 +- include/toml++/impl/utf8_streams_impl.h | 3 +- include/toml++/impl/value.h | 5 +- toml++.vcxproj | 2 + toml++.vcxproj.filters | 6 + toml.hpp | 118 ++++++++++++++++-- tools/generate_single_header.py | 22 ++-- 31 files changed, 210 insertions(+), 69 deletions(-) create mode 100644 include/toml++/impl/header_end.h create mode 100644 include/toml++/impl/header_start.h diff --git a/include/toml++/impl/array.h b/include/toml++/impl/array.h index 7a1654c..8f4f4da 100644 --- a/include/toml++/impl/array.h +++ b/include/toml++/impl/array.h @@ -5,6 +5,7 @@ #pragma once #include "value.h" +#include "header_start.h" /// \cond TOML_IMPL_NAMESPACE_START @@ -1114,3 +1115,5 @@ TOML_NAMESPACE_START }; } TOML_NAMESPACE_END; + +#include "header_end.h" diff --git a/include/toml++/impl/array_impl.h b/include/toml++/impl/array_impl.h index bfa17ef..ea7933c 100644 --- a/include/toml++/impl/array_impl.h +++ b/include/toml++/impl/array_impl.h @@ -12,7 +12,7 @@ //# }} #include "array.h" - +#include "header_start.h" /// \cond TOML_NAMESPACE_START @@ -281,3 +281,4 @@ TOML_NAMESPACE_START TOML_NAMESPACE_END; /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/common.h b/include/toml++/impl/common.h index e33c9c4..5842b0c 100644 --- a/include/toml++/impl/common.h +++ b/include/toml++/impl/common.h @@ -5,6 +5,7 @@ #pragma once #include "preprocessor.h" +#include "header_start.h" //#==================================================================================================================== //# INCLUDES @@ -1287,3 +1288,5 @@ TOML_NAMESPACE_START /// \endcond } TOML_NAMESPACE_END; + +#include "header_end.h" diff --git a/include/toml++/impl/date_time.h b/include/toml++/impl/date_time.h index 3b588e0..004e112 100644 --- a/include/toml++/impl/date_time.h +++ b/include/toml++/impl/date_time.h @@ -5,6 +5,7 @@ #pragma once #include "common.h" +#include "header_start.h" TOML_NAMESPACE_START { @@ -416,3 +417,5 @@ TOML_NAMESPACE_START #endif } TOML_NAMESPACE_END; + +#include "header_end.h" diff --git a/include/toml++/impl/default_formatter.h b/include/toml++/impl/default_formatter.h index 97c82e2..3127a55 100644 --- a/include/toml++/impl/default_formatter.h +++ b/include/toml++/impl/default_formatter.h @@ -8,9 +8,7 @@ #include "table.h" #include "array.h" #include "utf8.h" - -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; +#include "header_start.h" /// \cond TOML_IMPL_NAMESPACE_START @@ -456,4 +454,4 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +#include "header_end.h" diff --git a/include/toml++/impl/default_formatter_impl.h b/include/toml++/impl/default_formatter_impl.h index 74bf7de..ec46719 100644 --- a/include/toml++/impl/default_formatter_impl.h +++ b/include/toml++/impl/default_formatter_impl.h @@ -12,11 +12,9 @@ //# }} #include "default_formatter.h" - +#include "header_start.h" /// \cond -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -282,6 +280,5 @@ TOML_IMPL_NAMESPACE_END; #endif // TOML_WINDOWS_COMPAT -TOML_POP_WARNINGS; - /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/formatter.h b/include/toml++/impl/formatter.h index 0c7eb49..1e29aa5 100644 --- a/include/toml++/impl/formatter.h +++ b/include/toml++/impl/formatter.h @@ -2,16 +2,14 @@ //# Copyright (c) Mark Gillard //# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. // SPDX-License-Identifier: MIT -/// \cond #pragma once #include "print_to_stream.h" #if TOML_PARSER && !TOML_EXCEPTIONS #include "parse_result.h" #endif - -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; +#include "header_start.h" +/// \cond TOML_IMPL_NAMESPACE_START { @@ -34,6 +32,7 @@ TOML_IMPL_NAMESPACE_START { return *source_; } + TOML_NODISCARD std::basic_ostream& stream() const noexcept { @@ -290,6 +289,5 @@ TOML_IMPL_NAMESPACE_START } TOML_IMPL_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS - /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/header_end.h b/include/toml++/impl/header_end.h new file mode 100644 index 0000000..39f09d1 --- /dev/null +++ b/include/toml++/impl/header_end.h @@ -0,0 +1,6 @@ +//# {{ +#ifdef __INTELLISENSE__ + #include "preprocessor.h" +#endif +//# }} +TOML_POP_WARNINGS; diff --git a/include/toml++/impl/header_start.h b/include/toml++/impl/header_start.h new file mode 100644 index 0000000..d3b2e5d --- /dev/null +++ b/include/toml++/impl/header_start.h @@ -0,0 +1,8 @@ +//# {{ +#ifdef __INTELLISENSE__ + #include "preprocessor.h" +#endif +//# }} +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; diff --git a/include/toml++/impl/json_formatter.h b/include/toml++/impl/json_formatter.h index d95a630..7b152d8 100644 --- a/include/toml++/impl/json_formatter.h +++ b/include/toml++/impl/json_formatter.h @@ -7,9 +7,7 @@ #include "formatter.h" #include "table.h" #include "array.h" - -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; +#include "header_start.h" TOML_NAMESPACE_START { @@ -192,4 +190,4 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +#include "header_end.h" diff --git a/include/toml++/impl/json_formatter_impl.h b/include/toml++/impl/json_formatter_impl.h index 79d2c7d..f9b2020 100644 --- a/include/toml++/impl/json_formatter_impl.h +++ b/include/toml++/impl/json_formatter_impl.h @@ -12,12 +12,9 @@ //# }} #include "json_formatter.h" - +#include "header_start.h" /// \cond -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; - TOML_NAMESPACE_START { template @@ -60,6 +57,5 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; - /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/node.h b/include/toml++/impl/node.h index 634d9b3..95c9cd5 100644 --- a/include/toml++/impl/node.h +++ b/include/toml++/impl/node.h @@ -5,6 +5,7 @@ #pragma once #include "common.h" +#include "header_start.h" TOML_NAMESPACE_START { @@ -995,3 +996,5 @@ TOML_NAMESPACE_START }; } TOML_NAMESPACE_END; + +#include "header_end.h" diff --git a/include/toml++/impl/node_impl.h b/include/toml++/impl/node_impl.h index 0df46b4..fee0262 100644 --- a/include/toml++/impl/node_impl.h +++ b/include/toml++/impl/node_impl.h @@ -12,6 +12,8 @@ //# }} #include "node.h" +#include "header_start.h" +/// \cond TOML_NAMESPACE_START { @@ -60,3 +62,6 @@ TOML_NAMESPACE_START } } TOML_NAMESPACE_END; + +/// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/node_view.h b/include/toml++/impl/node_view.h index 372ef4f..9961dd7 100644 --- a/include/toml++/impl/node_view.h +++ b/include/toml++/impl/node_view.h @@ -7,8 +7,8 @@ #include "table.h" #include "array.h" #include "value.h" +#include "header_start.h" -TOML_PUSH_WARNINGS; TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_NAMESPACE_START @@ -812,4 +812,4 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_ARITHMETIC_WARNINGS +#include "header_end.h" diff --git a/include/toml++/impl/parse_error.h b/include/toml++/impl/parse_error.h index 837bfb7..4317f39 100644 --- a/include/toml++/impl/parse_error.h +++ b/include/toml++/impl/parse_error.h @@ -11,7 +11,7 @@ #endif //# }} -TOML_PUSH_WARNINGS; +#include "header_start.h" TOML_DISABLE_INIT_WARNINGS; TOML_NAMESPACE_START @@ -147,4 +147,4 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_INIT_WARNINGS +#include "header_end.h" diff --git a/include/toml++/impl/parse_result.h b/include/toml++/impl/parse_result.h index 145f732..d49838b 100644 --- a/include/toml++/impl/parse_result.h +++ b/include/toml++/impl/parse_result.h @@ -12,6 +12,7 @@ //# }} #include "table.h" #include "parse_error.h" +#include "header_start.h" #if defined(DOXYGEN) || !TOML_EXCEPTIONS TOML_NAMESPACE_START @@ -387,3 +388,5 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; #endif // !TOML_EXCEPTIONS + +#include "header_end.h" diff --git a/include/toml++/impl/parser.h b/include/toml++/impl/parser.h index 8f79465..4ca4e91 100644 --- a/include/toml++/impl/parser.h +++ b/include/toml++/impl/parser.h @@ -14,6 +14,7 @@ #include "parse_error.h" #include "parse_result.h" #include "utf8_streams.h" +#include "header_start.h" /// \cond TOML_IMPL_NAMESPACE_START @@ -442,3 +443,5 @@ TOML_NAMESPACE_START } } TOML_NAMESPACE_END; + +#include "header_end.h" diff --git a/include/toml++/impl/parser_impl.h b/include/toml++/impl/parser_impl.h index 64a5ab5..df2de9b 100644 --- a/include/toml++/impl/parser_impl.h +++ b/include/toml++/impl/parser_impl.h @@ -21,13 +21,11 @@ TOML_DISABLE_WARNINGS; using namespace std::string_view_literals; #endif TOML_ENABLE_WARNINGS; - +#include "header_start.h" /// \cond -TOML_PUSH_WARNINGS; -TOML_DISABLE_SPAM_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; TOML_DISABLE_INIT_WARNINGS; + #if TOML_MSVC #pragma warning(disable : 6001) // using uninitialized memory (false positive) #endif @@ -3186,6 +3184,5 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; - /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/preprocessor.h b/include/toml++/impl/preprocessor.h index f472009..571607f 100644 --- a/include/toml++/impl/preprocessor.h +++ b/include/toml++/impl/preprocessor.h @@ -162,8 +162,8 @@ #endif #define TOML_DISABLE_SWITCH_WARNINGS \ - __pragma(warning(disable: 4061)) \ - __pragma(warning(disable: 4062)) \ + __pragma(warning(disable: 4061)) /* enumerator 'identifier' is not explicitly handled by a case label */ \ + __pragma(warning(disable: 4062)) /* enumerator 'identifier' is not handled */ \ __pragma(warning(disable: 4063)) \ __pragma(warning(disable: 26819)) \ static_assert(true) diff --git a/include/toml++/impl/print_to_stream.h b/include/toml++/impl/print_to_stream.h index 5647bb1..55589a1 100644 --- a/include/toml++/impl/print_to_stream.h +++ b/include/toml++/impl/print_to_stream.h @@ -5,9 +5,8 @@ #pragma once #include "date_time.h" +#include "header_start.h" -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -463,4 +462,4 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; +#include "header_end.h" diff --git a/include/toml++/impl/table.h b/include/toml++/impl/table.h index ac5835e..1f0bf31 100644 --- a/include/toml++/impl/table.h +++ b/include/toml++/impl/table.h @@ -5,6 +5,7 @@ #pragma once #include "array.h" +#include "header_start.h" /// \cond TOML_IMPL_NAMESPACE_START @@ -1331,3 +1332,5 @@ TOML_NAMESPACE_START #endif // !DOXYGEN } TOML_NAMESPACE_END; + +#include "header_end.h" diff --git a/include/toml++/impl/table_impl.h b/include/toml++/impl/table_impl.h index 3512597..3f51fa0 100644 --- a/include/toml++/impl/table_impl.h +++ b/include/toml++/impl/table_impl.h @@ -13,7 +13,7 @@ #include "table.h" #include "node_view.h" - +#include "header_start.h" /// \cond TOML_NAMESPACE_START @@ -208,3 +208,4 @@ TOML_NAMESPACE_START TOML_NAMESPACE_END; /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/template_instantiations.h b/include/toml++/impl/template_instantiations.h index f8d2812..8a5322b 100644 --- a/include/toml++/impl/template_instantiations.h +++ b/include/toml++/impl/template_instantiations.h @@ -25,6 +25,8 @@ TOML_ENABLE_WARNINGS; #if TOML_PARSER #include "parser.h" #endif +#include "header_start.h" +/// \cond // internal implementation namespace TOML_IMPL_NAMESPACE_START @@ -146,3 +148,6 @@ TOML_NAMESPACE_START #endif // TOML_PARSER } TOML_NAMESPACE_END; + +/// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/utf8.h b/include/toml++/impl/utf8.h index 1849bb0..a8f39b6 100644 --- a/include/toml++/impl/utf8.h +++ b/include/toml++/impl/utf8.h @@ -5,9 +5,7 @@ #pragma once #include "preprocessor.h" - -TOML_PUSH_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; +#include "header_start.h" /// \cond TOML_IMPL_NAMESPACE_START @@ -954,4 +952,4 @@ TOML_IMPL_NAMESPACE_START TOML_IMPL_NAMESPACE_END; /// \endcond -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +#include "header_end.h" diff --git a/include/toml++/impl/utf8_streams.h b/include/toml++/impl/utf8_streams.h index 093ce38..9ea0f43 100644 --- a/include/toml++/impl/utf8_streams.h +++ b/include/toml++/impl/utf8_streams.h @@ -12,7 +12,7 @@ //# }} #include "utf8.h" #include "parse_error.h" - +#include "header_start.h" /// \cond #if TOML_EXCEPTIONS @@ -397,3 +397,4 @@ TOML_IMPL_NAMESPACE_END; #undef TOML_ERROR /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/utf8_streams_impl.h b/include/toml++/impl/utf8_streams_impl.h index 009583b..6b441e5 100644 --- a/include/toml++/impl/utf8_streams_impl.h +++ b/include/toml++/impl/utf8_streams_impl.h @@ -15,7 +15,7 @@ //# }} #include "utf8_streams.h" - +#include "header_start.h" /// \cond #if !TOML_EXCEPTIONS @@ -114,3 +114,4 @@ TOML_IMPL_NAMESPACE_END; #undef TOML_ERROR_CHECK /// \endcond +#include "header_end.h" diff --git a/include/toml++/impl/value.h b/include/toml++/impl/value.h index e0ba551..49909d2 100644 --- a/include/toml++/impl/value.h +++ b/include/toml++/impl/value.h @@ -6,6 +6,7 @@ #pragma once #include "node.h" #include "print_to_stream.h" +#include "header_start.h" /// \cond // clang-format off @@ -69,10 +70,8 @@ // clang-format on /// \endcond -TOML_PUSH_WARNINGS; TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_DISABLE_INIT_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; /// \cond TOML_IMPL_NAMESPACE_START @@ -1161,4 +1160,4 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; +#include "header_end.h" diff --git a/toml++.vcxproj b/toml++.vcxproj index 1e7ae72..52292eb 100644 --- a/toml++.vcxproj +++ b/toml++.vcxproj @@ -42,6 +42,8 @@ + + diff --git a/toml++.vcxproj.filters b/toml++.vcxproj.filters index f20d6a0..c38dbf8 100644 --- a/toml++.vcxproj.filters +++ b/toml++.vcxproj.filters @@ -82,6 +82,12 @@ include\impl + + include\impl + + + include\impl + diff --git a/toml.hpp b/toml.hpp index e51ce50..5e96481 100644 --- a/toml.hpp +++ b/toml.hpp @@ -192,8 +192,8 @@ #endif #define TOML_DISABLE_SWITCH_WARNINGS \ - __pragma(warning(disable: 4061)) \ - __pragma(warning(disable: 4062)) \ + __pragma(warning(disable: 4061)) /* enumerator 'identifier' is not explicitly handled by a case label */ \ + __pragma(warning(disable: 4062)) /* enumerator 'identifier' is not handled */ \ __pragma(warning(disable: 4063)) \ __pragma(warning(disable: 26819)) \ static_assert(true) @@ -856,6 +856,10 @@ TOML_DISABLE_SPAM_WARNINGS; //******** impl/common.h ********************************************************************************************* +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_DISABLE_WARNINGS; #include #include @@ -1932,8 +1936,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/date_time.h ****************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_NAMESPACE_START { struct TOML_TRIVIAL_ABI date @@ -2236,10 +2246,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/print_to_stream.h ************************************************************************************ TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; + TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -2659,6 +2673,10 @@ TOML_POP_WARNINGS; //******** impl/node.h *********************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_NAMESPACE_START { class TOML_ABSTRACT_BASE TOML_API node @@ -3261,8 +3279,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/value.h ********************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + // clang-format off #if TOML_WINDOWS_COMPAT @@ -3323,10 +3347,8 @@ TOML_NAMESPACE_END; // clang-format on -TOML_PUSH_WARNINGS; TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_DISABLE_INIT_WARNINGS; -TOML_DISABLE_SWITCH_WARNINGS; TOML_IMPL_NAMESPACE_START { @@ -4281,6 +4303,10 @@ TOML_POP_WARNINGS; //******** impl/array.h ********************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_IMPL_NAMESPACE_START { template @@ -4929,8 +4955,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/table.h ********************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_IMPL_NAMESPACE_START { template @@ -5663,9 +5695,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/node_view.h ****************************************************************************************** TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_NAMESPACE_START @@ -6171,11 +6208,12 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_ARITHMETIC_WARNINGS +TOML_POP_WARNINGS; //******** impl/utf8.h *********************************************************************************************** TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -7114,13 +7152,16 @@ TOML_IMPL_NAMESPACE_START } TOML_IMPL_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +TOML_POP_WARNINGS; #if TOML_PARSER //******** impl/parse_error.h **************************************************************************************** TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_DISABLE_INIT_WARNINGS; TOML_NAMESPACE_START @@ -7225,10 +7266,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_INIT_WARNINGS +TOML_POP_WARNINGS; //******** impl/parse_result.h *************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + #if defined(DOXYGEN) || !TOML_EXCEPTIONS TOML_NAMESPACE_START { @@ -7501,8 +7546,14 @@ TOML_NAMESPACE_START TOML_NAMESPACE_END; #endif // !TOML_EXCEPTIONS +TOML_POP_WARNINGS; + //******** impl/utf8_streams.h *************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + #if TOML_EXCEPTIONS #define TOML_ERROR_CHECK (void)0 #define TOML_ERROR throw parse_error @@ -7884,8 +7935,14 @@ TOML_IMPL_NAMESPACE_END; #undef TOML_ERROR_CHECK #undef TOML_ERROR +TOML_POP_WARNINGS; + //******** impl/parser.h ********************************************************************************************* +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_IMPL_NAMESPACE_START { TOML_ABI_NAMESPACE_BOOL(TOML_EXCEPTIONS, ex, noex); @@ -8017,6 +8074,8 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + #endif // TOML_PARSER //******** impl/formatter.h ****************************************************************************************** @@ -8026,6 +8085,7 @@ TOML_NAMESPACE_END; #endif TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -8049,6 +8109,7 @@ TOML_IMPL_NAMESPACE_START { return *source_; } + TOML_NODISCARD std::basic_ostream& stream() const noexcept { @@ -8305,11 +8366,12 @@ TOML_IMPL_NAMESPACE_START } TOML_IMPL_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +TOML_POP_WARNINGS; //******** impl/default_formatter.h ********************************************************************************** TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -8694,11 +8756,12 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +TOML_POP_WARNINGS; //******** impl/json_formatter.h ************************************************************************************* TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; TOML_NAMESPACE_START @@ -8817,12 +8880,16 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; -TOML_POP_WARNINGS; // TOML_DISABLE_SWITCH_WARNINGS +TOML_POP_WARNINGS; #if TOML_IMPLEMENTATION //******** impl/node_impl.h ****************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_NAMESPACE_START { TOML_EXTERNAL_LINKAGE @@ -8871,8 +8938,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/array_impl.h ***************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_NAMESPACE_START { TOML_EXTERNAL_LINKAGE @@ -9138,8 +9211,14 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + //******** impl/table_impl.h ***************************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + TOML_NAMESPACE_START { TOML_EXTERNAL_LINKAGE @@ -9331,10 +9410,16 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + #if TOML_PARSER //******** impl/utf8_streams_impl.h ********************************************************************************** +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + #if !TOML_EXCEPTIONS #undef TOML_ERROR_CHECK #define TOML_ERROR_CHECK \ @@ -9430,6 +9515,8 @@ TOML_IMPL_NAMESPACE_END; #undef TOML_ERROR_CHECK +TOML_POP_WARNINGS; + //******** impl/parser_impl.h **************************************************************************************** TOML_DISABLE_WARNINGS; @@ -9442,7 +9529,9 @@ TOML_ENABLE_WARNINGS; TOML_PUSH_WARNINGS; TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; + TOML_DISABLE_INIT_WARNINGS; + #if TOML_MSVC #pragma warning(disable : 6001) // using uninitialized memory (false positive) #endif @@ -12607,7 +12696,9 @@ TOML_POP_WARNINGS; //******** impl/default_formatter_impl.h ***************************************************************************** TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; + TOML_DISABLE_ARITHMETIC_WARNINGS; TOML_IMPL_NAMESPACE_START @@ -12878,6 +12969,7 @@ TOML_POP_WARNINGS; //******** impl/json_formatter_impl.h ******************************************************************************** TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; TOML_DISABLE_SWITCH_WARNINGS; TOML_NAMESPACE_START @@ -12937,6 +13029,10 @@ TOML_ENABLE_WARNINGS; #endif +TOML_PUSH_WARNINGS; +TOML_DISABLE_SPAM_WARNINGS; +TOML_DISABLE_SWITCH_WARNINGS; + // internal implementation namespace TOML_IMPL_NAMESPACE_START { @@ -13058,6 +13154,8 @@ TOML_NAMESPACE_START } TOML_NAMESPACE_END; +TOML_POP_WARNINGS; + #endif // !TOML_HEADER_ONLY #endif // TOML_IMPLEMENTATION diff --git a/tools/generate_single_header.py b/tools/generate_single_header.py index 714b185..8bd6278 100644 --- a/tools/generate_single_header.py +++ b/tools/generate_single_header.py @@ -16,9 +16,13 @@ from io import StringIO class Preprocessor: __re_includes = re.compile(r'^\s*#\s*include\s+"(.+?)"', re.I | re.M) + __multiples_allowed = [ + r'impl/header_start.h', + r'impl/header_end.h' + ] def __init__(self, file): - self.__processed_includes = [] + self.__processed_includes = set() self.__current_level = 0 self.__directory_stack = [ Path.cwd() ] self.__entry_root = '' @@ -32,12 +36,17 @@ class Preprocessor: incl = Path(incl.strip().replace('\\',r'/')) if not incl.is_absolute(): incl = Path(self.__directory_stack[-1], incl).resolve() - if incl in self.__processed_includes: - return '' if self.__current_level == 0 and self.__entry_root == '': self.__entry_root = str(incl.parent).replace('\\',r'/') - self.__processed_includes.append(incl) + relative_path = str(incl).replace('\\',r'/') + if relative_path.startswith(self.__entry_root): + relative_path = relative_path[len(self.__entry_root):].strip('/') + + if incl in self.__processed_includes and relative_path not in self.__multiples_allowed: + return '' + + self.__processed_includes.add(incl) self.__directory_stack.append(incl.parent) text = utils.read_all_text_from_file(incl, logger=True).strip() + '\n' @@ -47,10 +56,7 @@ class Preprocessor: self.__current_level -= 1 if self.__current_level == 1: - header = str(incl).replace('\\',r'/') - if header.startswith(self.__entry_root): - header = header[len(self.__entry_root):].strip('/') - header = utils.make_divider(header, 10, pattern = r'*') + header = utils.make_divider(relative_path, 10, pattern = r'*') text = f'{header}\n\n{text}' self.__directory_stack.pop()