diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c940eccb..50e8ef13 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -8,8 +8,8 @@ assignees: marzer --- @@ -20,12 +20,12 @@ assignees: marzer **toml++ version and/or commit hash:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 16f91f50..9e5fd764 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -8,8 +8,8 @@ assignees: marzer --- @@ -19,7 +19,7 @@ assignees: marzer **Is your feature request related to a problem? Please describe.** diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 16999ab4..1d269acb 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,5 @@ @@ -24,7 +22,7 @@ **Pre-merge checklist** - [ ] I've read [CONTRIBUTING.md] - [ ] I've rebased my changes against the current HEAD of `origin/master` (if necessary) @@ -34,17 +32,8 @@ - [ ] I've rebuilt and run the tests with at least one of: - [ ] Clang 6 or higher - [ ] GCC 7 or higher - - [ ] Visual Studio 2019 -- [ ] I've given myself mad props by adding my name to the list of contributors in [README.md](https://github.com/marzer/tomlplusplus/blob/master/README.md) - - - -**Anything else?** - + - [ ] MSVC 19.20 (Visual Studio 2019) or higher +- [ ] I've added my name to the list of contributors in [README.md](https://github.com/marzer/tomlplusplus/blob/master/README.md) diff --git a/include/toml++/toml_array.h b/include/toml++/toml_array.h index 971296d7..386e1c0c 100644 --- a/include/toml++/toml_array.h +++ b/include/toml++/toml_array.h @@ -1036,7 +1036,7 @@ TOML_NAMESPACE_START /// \returns An rvalue reference to the array. array&& flatten() && { - return static_cast(static_cast(*this).flatten()); + return static_cast(this->flatten()); } /// \brief Prints the array out to a stream as formatted TOML. diff --git a/include/toml++/toml_default_formatter.hpp b/include/toml++/toml_default_formatter.hpp index d2c4034b..e2d14f4d 100644 --- a/include/toml++/toml_default_formatter.hpp +++ b/include/toml++/toml_default_formatter.hpp @@ -53,10 +53,7 @@ TOML_IMPL_NAMESPACE_START for (auto c : str) { if TOML_UNLIKELY(c >= '\x00' && c <= '\x1F') - { - const auto& sv = low_character_escape_table[c]; - s.append(reinterpret_cast(sv.data()), sv.length()); - } + s.append(low_character_escape_table[c]); else if TOML_UNLIKELY(c == '\x7F') s.append("\\u007F"sv); else if TOML_UNLIKELY(c == '"') @@ -141,7 +138,7 @@ TOML_IMPL_NAMESPACE_START weight += 1; v *= -1.0; } - return weight + static_cast(log10(static_cast(v))) + 1_sz; + return weight + static_cast(log10(v)) + 1_sz; break; } diff --git a/include/toml++/toml_preprocessor.h b/include/toml++/toml_preprocessor.h index 26b67167..566e98c9 100644 --- a/include/toml++/toml_preprocessor.h +++ b/include/toml++/toml_preprocessor.h @@ -168,6 +168,7 @@ _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \ _Pragma("GCC diagnostic ignored \"-Wcomment\"") \ _Pragma("GCC diagnostic ignored \"-Wtype-limits\"") \ + _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") \ _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") \ _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=pure\"") #define TOML_POP_WARNINGS _Pragma("GCC diagnostic pop") diff --git a/meson.build b/meson.build index 9cc1f839..b7a817b2 100644 --- a/meson.build +++ b/meson.build @@ -118,6 +118,7 @@ if is_gcc '-Wunreachable-code', '-Wunused', '-Wunused-parameter', + '-Wuseless-cast', '-Wvariadic-macros', '-Wwrite-strings', '-Wmissing-noreturn', diff --git a/python/generate_windows_test_targets.py b/python/generate_windows_test_targets.py index 3567b321..2cf96757 100644 --- a/python/generate_windows_test_targets.py +++ b/python/generate_windows_test_targets.py @@ -129,7 +129,6 @@ def main(): - diff --git a/tests/evil_macros.h b/tests/evil_macros.h deleted file mode 100644 index 28ebb362..00000000 --- a/tests/evil_macros.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -// simulate some 'evil' macros to ensure the library is robust against them if they appear in the wild. - -#ifdef _WIN32 - -#ifndef min - #define min(...) THIS_IS_AN_EVIL_MACRO -#endif - -#ifndef max - #define max(...) THIS_IS_AN_EVIL_MACRO -#endif - -#ifndef near - #define near THIS_IS_AN_EVIL_MACRO -#endif - -#ifndef far - #define far THIS_IS_AN_EVIL_MACRO -#endif - -#else - -// ... - -#endif diff --git a/tests/manipulating_values.cpp b/tests/manipulating_values.cpp index 1a9fa353..821db640 100644 --- a/tests/manipulating_values.cpp +++ b/tests/manipulating_values.cpp @@ -11,6 +11,8 @@ TOML_DISABLE_WARNINGS TOML_ENABLE_WARNINGS #endif +TOML_DISABLE_SPAM_WARNINGS + template static constexpr T one = static_cast(1); diff --git a/tests/tests.h b/tests/tests.h index 05a9650b..b1d4ee34 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -10,8 +10,6 @@ #include "tloptional.h" #endif -#include "evil_macros.h" - #if USE_SINGLE_HEADER #include "../toml.hpp" #else diff --git a/toml.hpp b/toml.hpp index 76e588e8..a902cb45 100644 --- a/toml.hpp +++ b/toml.hpp @@ -190,6 +190,7 @@ _Pragma("GCC diagnostic ignored \"-Wcast-align\"") \ _Pragma("GCC diagnostic ignored \"-Wcomment\"") \ _Pragma("GCC diagnostic ignored \"-Wtype-limits\"") \ + _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"") \ _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") \ _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=pure\"") #define TOML_POP_WARNINGS _Pragma("GCC diagnostic pop") @@ -3963,7 +3964,7 @@ TOML_NAMESPACE_START array& flatten() &; array&& flatten() && { - return static_cast(static_cast(*this).flatten()); + return static_cast(this->flatten()); } template @@ -8368,10 +8369,7 @@ TOML_IMPL_NAMESPACE_START for (auto c : str) { if TOML_UNLIKELY(c >= '\x00' && c <= '\x1F') - { - const auto& sv = low_character_escape_table[c]; - s.append(reinterpret_cast(sv.data()), sv.length()); - } + s.append(low_character_escape_table[c]); else if TOML_UNLIKELY(c == '\x7F') s.append("\\u007F"sv); else if TOML_UNLIKELY(c == '"') @@ -8456,7 +8454,7 @@ TOML_IMPL_NAMESPACE_START weight += 1; v *= -1.0; } - return weight + static_cast(log10(static_cast(v))) + 1_sz; + return weight + static_cast(log10(v)) + 1_sz; break; } diff --git a/vs/tests/test_debug_x64.vcxproj b/vs/tests/test_debug_x64.vcxproj index 2f401abc..b77042f6 100644 --- a/vs/tests/test_debug_x64.vcxproj +++ b/vs/tests/test_debug_x64.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_cpplatest.vcxproj b/vs/tests/test_debug_x64_cpplatest.vcxproj index bccf9365..ab61eff2 100644 --- a/vs/tests/test_debug_x64_cpplatest.vcxproj +++ b/vs/tests/test_debug_x64_cpplatest.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_cpplatest_noexcept.vcxproj b/vs/tests/test_debug_x64_cpplatest_noexcept.vcxproj index 72e753f9..8832b36e 100644 --- a/vs/tests/test_debug_x64_cpplatest_noexcept.vcxproj +++ b/vs/tests/test_debug_x64_cpplatest_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_cpplatest_noexcept_unrel.vcxproj b/vs/tests/test_debug_x64_cpplatest_noexcept_unrel.vcxproj index ababa99d..8b06b950 100644 --- a/vs/tests/test_debug_x64_cpplatest_noexcept_unrel.vcxproj +++ b/vs/tests/test_debug_x64_cpplatest_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_cpplatest_unrel.vcxproj b/vs/tests/test_debug_x64_cpplatest_unrel.vcxproj index f8e2e31e..be56fedc 100644 --- a/vs/tests/test_debug_x64_cpplatest_unrel.vcxproj +++ b/vs/tests/test_debug_x64_cpplatest_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_noexcept.vcxproj b/vs/tests/test_debug_x64_noexcept.vcxproj index 52643063..dc460330 100644 --- a/vs/tests/test_debug_x64_noexcept.vcxproj +++ b/vs/tests/test_debug_x64_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_noexcept_unrel.vcxproj b/vs/tests/test_debug_x64_noexcept_unrel.vcxproj index d2a0a44e..9f5e1eb0 100644 --- a/vs/tests/test_debug_x64_noexcept_unrel.vcxproj +++ b/vs/tests/test_debug_x64_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x64_unrel.vcxproj b/vs/tests/test_debug_x64_unrel.vcxproj index 57e4b33d..c6641a06 100644 --- a/vs/tests/test_debug_x64_unrel.vcxproj +++ b/vs/tests/test_debug_x64_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86.vcxproj b/vs/tests/test_debug_x86.vcxproj index cbaa4351..f256b99a 100644 --- a/vs/tests/test_debug_x86.vcxproj +++ b/vs/tests/test_debug_x86.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_cpplatest.vcxproj b/vs/tests/test_debug_x86_cpplatest.vcxproj index 268b4757..d264c74d 100644 --- a/vs/tests/test_debug_x86_cpplatest.vcxproj +++ b/vs/tests/test_debug_x86_cpplatest.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_cpplatest_noexcept.vcxproj b/vs/tests/test_debug_x86_cpplatest_noexcept.vcxproj index 5bdddf7d..b22ce6de 100644 --- a/vs/tests/test_debug_x86_cpplatest_noexcept.vcxproj +++ b/vs/tests/test_debug_x86_cpplatest_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_cpplatest_noexcept_unrel.vcxproj b/vs/tests/test_debug_x86_cpplatest_noexcept_unrel.vcxproj index 462a7306..f576d40e 100644 --- a/vs/tests/test_debug_x86_cpplatest_noexcept_unrel.vcxproj +++ b/vs/tests/test_debug_x86_cpplatest_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_cpplatest_unrel.vcxproj b/vs/tests/test_debug_x86_cpplatest_unrel.vcxproj index d39d4375..03f199e8 100644 --- a/vs/tests/test_debug_x86_cpplatest_unrel.vcxproj +++ b/vs/tests/test_debug_x86_cpplatest_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_noexcept.vcxproj b/vs/tests/test_debug_x86_noexcept.vcxproj index cb5f3f21..c3beeafe 100644 --- a/vs/tests/test_debug_x86_noexcept.vcxproj +++ b/vs/tests/test_debug_x86_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_noexcept_unrel.vcxproj b/vs/tests/test_debug_x86_noexcept_unrel.vcxproj index 3f558d5b..b98df2e0 100644 --- a/vs/tests/test_debug_x86_noexcept_unrel.vcxproj +++ b/vs/tests/test_debug_x86_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_debug_x86_unrel.vcxproj b/vs/tests/test_debug_x86_unrel.vcxproj index 99d8da96..804c4f00 100644 --- a/vs/tests/test_debug_x86_unrel.vcxproj +++ b/vs/tests/test_debug_x86_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64.vcxproj b/vs/tests/test_release_x64.vcxproj index fd2b71ff..2eff305c 100644 --- a/vs/tests/test_release_x64.vcxproj +++ b/vs/tests/test_release_x64.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_cpplatest.vcxproj b/vs/tests/test_release_x64_cpplatest.vcxproj index a3b3ce58..ef2cbf1f 100644 --- a/vs/tests/test_release_x64_cpplatest.vcxproj +++ b/vs/tests/test_release_x64_cpplatest.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_cpplatest_noexcept.vcxproj b/vs/tests/test_release_x64_cpplatest_noexcept.vcxproj index f0ed3858..cb08288d 100644 --- a/vs/tests/test_release_x64_cpplatest_noexcept.vcxproj +++ b/vs/tests/test_release_x64_cpplatest_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_cpplatest_noexcept_unrel.vcxproj b/vs/tests/test_release_x64_cpplatest_noexcept_unrel.vcxproj index 3576acdc..adfbc048 100644 --- a/vs/tests/test_release_x64_cpplatest_noexcept_unrel.vcxproj +++ b/vs/tests/test_release_x64_cpplatest_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_cpplatest_unrel.vcxproj b/vs/tests/test_release_x64_cpplatest_unrel.vcxproj index 97d927f3..255f556f 100644 --- a/vs/tests/test_release_x64_cpplatest_unrel.vcxproj +++ b/vs/tests/test_release_x64_cpplatest_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_noexcept.vcxproj b/vs/tests/test_release_x64_noexcept.vcxproj index a7a4a312..1f292511 100644 --- a/vs/tests/test_release_x64_noexcept.vcxproj +++ b/vs/tests/test_release_x64_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_noexcept_unrel.vcxproj b/vs/tests/test_release_x64_noexcept_unrel.vcxproj index eb0c2ed7..6b3757d6 100644 --- a/vs/tests/test_release_x64_noexcept_unrel.vcxproj +++ b/vs/tests/test_release_x64_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x64_unrel.vcxproj b/vs/tests/test_release_x64_unrel.vcxproj index 0d95ae37..588f1550 100644 --- a/vs/tests/test_release_x64_unrel.vcxproj +++ b/vs/tests/test_release_x64_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86.vcxproj b/vs/tests/test_release_x86.vcxproj index ce59380a..1aa3a2e1 100644 --- a/vs/tests/test_release_x86.vcxproj +++ b/vs/tests/test_release_x86.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_cpplatest.vcxproj b/vs/tests/test_release_x86_cpplatest.vcxproj index a5cfbaeb..a6795d97 100644 --- a/vs/tests/test_release_x86_cpplatest.vcxproj +++ b/vs/tests/test_release_x86_cpplatest.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_cpplatest_noexcept.vcxproj b/vs/tests/test_release_x86_cpplatest_noexcept.vcxproj index b2bd7fd4..ec04f231 100644 --- a/vs/tests/test_release_x86_cpplatest_noexcept.vcxproj +++ b/vs/tests/test_release_x86_cpplatest_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_cpplatest_noexcept_unrel.vcxproj b/vs/tests/test_release_x86_cpplatest_noexcept_unrel.vcxproj index b42177df..76437c15 100644 --- a/vs/tests/test_release_x86_cpplatest_noexcept_unrel.vcxproj +++ b/vs/tests/test_release_x86_cpplatest_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_cpplatest_unrel.vcxproj b/vs/tests/test_release_x86_cpplatest_unrel.vcxproj index a1ca6545..07038b72 100644 --- a/vs/tests/test_release_x86_cpplatest_unrel.vcxproj +++ b/vs/tests/test_release_x86_cpplatest_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_noexcept.vcxproj b/vs/tests/test_release_x86_noexcept.vcxproj index 074bb226..6fa150a6 100644 --- a/vs/tests/test_release_x86_noexcept.vcxproj +++ b/vs/tests/test_release_x86_noexcept.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_noexcept_unrel.vcxproj b/vs/tests/test_release_x86_noexcept_unrel.vcxproj index 672f9cb9..a4505b1d 100644 --- a/vs/tests/test_release_x86_noexcept_unrel.vcxproj +++ b/vs/tests/test_release_x86_noexcept_unrel.vcxproj @@ -86,7 +86,6 @@ - diff --git a/vs/tests/test_release_x86_unrel.vcxproj b/vs/tests/test_release_x86_unrel.vcxproj index ef61035f..476ef644 100644 --- a/vs/tests/test_release_x86_unrel.vcxproj +++ b/vs/tests/test_release_x86_unrel.vcxproj @@ -86,7 +86,6 @@ -