Some clang specific fixes / warnings

This commit is contained in:
Jason Turner
2017-02-02 08:00:57 -08:00
parent 6b4c47c5ba
commit 24352c62e8
5 changed files with 35 additions and 25 deletions

View File

@@ -251,9 +251,9 @@ namespace chaiscript
~Sentinel()
{
// save new pointer data
const auto ptr = m_ptr.get().get();
m_data.get().m_data_ptr = ptr;
m_data.get().m_const_data_ptr = ptr;
const auto ptr_ = m_ptr.get().get();
m_data.get().m_data_ptr = ptr_;
m_data.get().m_const_data_ptr = ptr_;
}
Sentinel& operator=(Sentinel&&s) = default;

View File

@@ -2261,14 +2261,14 @@ namespace chaiscript
/// Reads a unary prefixed expression from input
bool Prefix() {
const auto prev_stack_top = m_match_stack.size();
using SS = utility::Static_String;
constexpr const std::array<utility::Static_String, 6> prefix_opers{
SS{"++"},
SS{"--"},
SS{"-"},
SS{"+"},
SS{"!"},
SS{"~"}};
constexpr const std::array<utility::Static_String, 6> prefix_opers{{
"++",
"--",
"-",
"+",
"!",
"~"
}};
for (const auto &oper : prefix_opers)
{
@@ -2426,7 +2426,7 @@ namespace chaiscript
using SS = utility::Static_String;
if (Operator()) {
for (const auto sym : {SS{"="}, SS{":="}, SS{"+="}, SS{"-="}, SS{"*="}, SS{"/="}, SS{"%="}, SS{"<<="}, SS{">>="}, SS{"&="}, SS{"^="}, SS{"|="}})
for (const auto &sym : {SS{"="}, SS{":="}, SS{"+="}, SS{"-="}, SS{"*="}, SS{"/="}, SS{"%="}, SS{"<<="}, SS{">>="}, SS{"&="}, SS{"^="}, SS{"|="}})
{
if (Symbol(sym, true)) {
SkipWS(true);

View File

@@ -21,6 +21,11 @@ namespace chaiscript
static constexpr std::uint32_t fnv1a_32(const char *s, std::uint32_t h = 0x811c9dc5) {
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#ifdef CHAISCRIPT_MSVC
#pragma warning(push)
#pragma warning(disable : 4307)
@@ -29,6 +34,11 @@ namespace chaiscript
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}

View File

@@ -1202,7 +1202,7 @@ TEST_CASE("Test reference member being registered")
double d;
chai.add(chaiscript::var(Reference_MyClass(d)), "ref");
chai.eval("ref.x = 2.3");
CHECK(d == 2.3);
CHECK(d == Approx(2.3));
}

View File

@@ -204,30 +204,30 @@ int main()
&& TEST_LITERAL(16777215u)
&& TEST_LITERAL(4294967295u)
&& TEST_LITERAL(-255u)
&& TEST_LITERAL(-65535u)
&& TEST_LITERAL(-16777215u)
&& TEST_LITERAL(-4294967295u)
&& TEST_LITERAL_SIGNED(-255u)
&& TEST_LITERAL_SIGNED(-65535u)
&& TEST_LITERAL_SIGNED(-16777215u)
&& TEST_LITERAL_SIGNED(-4294967295u)
&& TEST_LITERAL(255l)
&& TEST_LITERAL(65535l)
&& TEST_LITERAL(16777215l)
&& TEST_LITERAL(4294967295l)
&& TEST_LITERAL(-255l)
&& TEST_LITERAL(-65535l)
&& TEST_LITERAL(-16777215l)
&& TEST_LITERAL(-4294967295l)
&& TEST_LITERAL_SIGNED(-255l)
&& TEST_LITERAL_SIGNED(-65535l)
&& TEST_LITERAL_SIGNED(-16777215l)
&& TEST_LITERAL_SIGNED(-4294967295l)
&& TEST_LITERAL(255ul)
&& TEST_LITERAL(65535ul)
&& TEST_LITERAL(16777215ul)
&& TEST_LITERAL(4294967295ul)
&& TEST_LITERAL(-255ul)
&& TEST_LITERAL(-65535ul)
&& TEST_LITERAL(-16777215ul)
&& TEST_LITERAL(-4294967295ul)
&& TEST_LITERAL_SIGNED(-255ul)
&& TEST_LITERAL_SIGNED(-65535ul)
&& TEST_LITERAL_SIGNED(-16777215ul)
&& TEST_LITERAL_SIGNED(-4294967295ul)
&& TEST_LITERAL(255ull)
&& TEST_LITERAL(65535ull)