Skip to content

Commit

Permalink
fixed useless cast warning on GCC10
Browse files Browse the repository at this point in the history
also:
- removed 'evil macros' test file
- updated github templates
  • Loading branch information
marzer committed Dec 15, 2020
1 parent 54d80bb commit ea064da
Show file tree
Hide file tree
Showing 44 changed files with 25 additions and 99 deletions.
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ assignees: marzer
---

<!--
Please replace the HTML comments below with the requested information.
Or leave them there and put your answers above/below them; you do you!
Replace the HTML comments below with the requested information.
DO NOT delete this template and roll your own!
Thanks for contributing!
-->
Expand All @@ -20,12 +20,12 @@ assignees: marzer
**toml++ version and/or commit hash:**
<!--
If you're using the single-header version of the library, the version number is right at the top of the file.
Otherwise you can find it by opening toml++/toml_version.h; it'll be represented by three defines -
TOML_LANG_MAJOR, TOML_LANG_MINOR and TOML_LANG_PATCH.
If you're not using any particular release and are instead just living large at HEAD of master, the commit hash
would be super helpful too, though it's not critical.
Otherwise you can find it by opening toml++/toml_version.h; it'll be represented by three defines -
TOML_LANG_MAJOR, TOML_LANG_MINOR and TOML_LANG_PATCH.
If you're not using any particular release and are instead just living large at HEAD of master, the commit hash
would be super helpful too, though it's not critical.
-->


Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ assignees: marzer
---

<!--
Please replace the HTML comments below with the requested information.
Or leave them there and put your answers above/below them; you do you!
Replace the HTML comments below with the requested information.
DO NOT delete this template and roll your own!
Thanks for contributing!
-->
Expand All @@ -19,7 +19,7 @@ assignees: marzer
**Is your feature request related to a problem? Please describe.**
<!--
"I'd like a way to Fooify all Bars in one go. Currently I have to iterate through them and
do it individually myself, which is cumbersome.
do it individually myself, which is cumbersome.
-->


Expand Down
17 changes: 3 additions & 14 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<!--
Please replace the HTML comments below with the requested information.
Or leave them there and put your answers above/below them; you do you!
Thanks for contributing!
-->

Expand All @@ -24,7 +22,7 @@
**Pre-merge checklist**
<!--
Not all of these will necessarily apply, particularly if you're not making a code change (e.g. fixing documentation).
That's OK.
That's OK. Tick the ones that do by placing an x in them, e.g. [x]
--->
- [ ] I've read [CONTRIBUTING.md]
- [ ] I've rebased my changes against the current HEAD of `origin/master` (if necessary)
Expand All @@ -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?**
<!--
According to all known laws of aviation, there is no way a bee should be able to fly.
Its wings are too small to get its fat little body off the ground.
The bee, of course, flies anyway, because bees don't care what humans think is impossible.
--->
- [ ] 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)



Expand Down
2 changes: 1 addition & 1 deletion include/toml++/toml_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ TOML_NAMESPACE_START
/// \returns An rvalue reference to the array.
array&& flatten() &&
{
return static_cast<toml::array&&>(static_cast<toml::array&>(*this).flatten());
return static_cast<toml::array&&>(this->flatten());
}

/// \brief Prints the array out to a stream as formatted TOML.
Expand Down
7 changes: 2 additions & 5 deletions include/toml++/toml_default_formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char*>(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 == '"')
Expand Down Expand Up @@ -141,7 +138,7 @@ TOML_IMPL_NAMESPACE_START
weight += 1;
v *= -1.0;
}
return weight + static_cast<size_t>(log10(static_cast<double>(v))) + 1_sz;
return weight + static_cast<size_t>(log10(v)) + 1_sz;
break;
}

Expand Down
1 change: 1 addition & 0 deletions include/toml++/toml_preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ if is_gcc
'-Wunreachable-code',
'-Wunused',
'-Wunused-parameter',
'-Wuseless-cast',
'-Wvariadic-macros',
'-Wwrite-strings',
'-Wmissing-noreturn',
Expand Down
1 change: 0 additions & 1 deletion python/generate_windows_test_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def main():
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
27 changes: 0 additions & 27 deletions tests/evil_macros.h

This file was deleted.

2 changes: 2 additions & 0 deletions tests/manipulating_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ TOML_DISABLE_WARNINGS
TOML_ENABLE_WARNINGS
#endif

TOML_DISABLE_SPAM_WARNINGS

template <typename T>
static constexpr T one = static_cast<T>(1);

Expand Down
2 changes: 0 additions & 2 deletions tests/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#include "tloptional.h"
#endif

#include "evil_macros.h"

#if USE_SINGLE_HEADER
#include "../toml.hpp"
#else
Expand Down
10 changes: 4 additions & 6 deletions toml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -3963,7 +3964,7 @@ TOML_NAMESPACE_START
array& flatten() &;
array&& flatten() &&
{
return static_cast<toml::array&&>(static_cast<toml::array&>(*this).flatten());
return static_cast<toml::array&&>(this->flatten());
}

template <typename Char>
Expand Down Expand Up @@ -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<const char*>(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 == '"')
Expand Down Expand Up @@ -8456,7 +8454,7 @@ TOML_IMPL_NAMESPACE_START
weight += 1;
v *= -1.0;
}
return weight + static_cast<size_t>(log10(static_cast<double>(v))) + 1_sz;
return weight + static_cast<size_t>(log10(v)) + 1_sz;
break;
}

Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_cpplatest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_cpplatest_noexcept.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_cpplatest_noexcept_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_cpplatest_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_noexcept.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_noexcept_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x64_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_cpplatest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_cpplatest_noexcept.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_cpplatest_noexcept_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_cpplatest_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_noexcept.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_noexcept_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_debug_x86_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_release_x64.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_release_x64_cpplatest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_release_x64_cpplatest_noexcept.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_release_x64_cpplatest_noexcept_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
1 change: 0 additions & 1 deletion vs/tests/test_release_x64_cpplatest_unrel.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\tests\catch2.h" />
<ClInclude Include="..\..\tests\evil_macros.h" />
<ClInclude Include="..\..\tests\leakproof.h" />
<ClInclude Include="..\..\tests\settings.h" />
<ClInclude Include="..\..\tests\tests.h" />
Expand Down
Loading

0 comments on commit ea064da

Please sign in to comment.