fixed useless cast warning on GCC10

also:
- removed 'evil macros' test file
- updated github templates
This commit is contained in:
Mark Gillard 2020-12-15 13:39:58 +02:00
parent 54d80bb43b
commit ea064da16d
44 changed files with 25 additions and 99 deletions

View File

@ -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!
-->
@ -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.
-->

View File

@ -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!
-->
@ -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.
-->

View File

@ -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!
-->
@ -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)
@ -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)

View File

@ -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.

View File

@ -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 == '"')
@ -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;
}

View File

@ -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")

View File

@ -118,6 +118,7 @@ if is_gcc
'-Wunreachable-code',
'-Wunused',
'-Wunused-parameter',
'-Wuseless-cast',
'-Wvariadic-macros',
'-Wwrite-strings',
'-Wmissing-noreturn',

View File

@ -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" />

View File

@ -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

View File

@ -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);

View File

@ -10,8 +10,6 @@
#include "tloptional.h"
#endif
#include "evil_macros.h"
#if USE_SINGLE_HEADER
#include "../toml.hpp"
#else

View File

@ -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<toml::array&&>(static_cast<toml::array&>(*this).flatten());
return static_cast<toml::array&&>(this->flatten());
}
template <typename Char>
@ -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 == '"')
@ -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;
}

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />

View File

@ -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" />