Clean up more warnings with stricter warning levels

This commit is contained in:
Jason Turner
2015-01-15 14:24:39 -07:00
parent 41a45ce8b5
commit f95ca75aca
14 changed files with 71 additions and 48 deletions

View File

@@ -45,7 +45,8 @@ namespace chaiscript
{
}
virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT {}
bad_boxed_cast(const bad_boxed_cast &) = default;
virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT = default;
/// \brief Description of what error occurred
virtual const char * what() const CHAISCRIPT_NOEXCEPT CHAISCRIPT_OVERRIDE

View File

@@ -298,7 +298,7 @@ namespace chaiscript
}
}
static void throw_exception(const Boxed_Value &bv) {
static void throw_exception [[ noreturn ]] (const Boxed_Value &bv) {
throw bv;
}

View File

@@ -33,6 +33,15 @@ namespace chaiscript
#pragma warning(disable : 4244 4018 4389 4146 4365)
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
/// \brief Represents any numeric type, generically. Used internally for generic operations between POD values
class Boxed_Number
{
@@ -40,9 +49,6 @@ namespace chaiscript
struct boolean
{
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wsign-compare"
#endif
template<typename T, typename U>
static Boxed_Value go(Operators::Opers t_oper, const T &t, const U &u, const Boxed_Value &)
{
@@ -850,14 +856,18 @@ namespace chaiscript
struct Cast_Helper<const Boxed_Number &> : Cast_Helper<Boxed_Number>
{
};
/// Cast_Helper for converting from Boxed_Value to Boxed_Number
template<>
struct Cast_Helper<const Boxed_Number> : Cast_Helper<Boxed_Number>
{
};
};
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#ifdef CHAISCRIPT_MSVC
#pragma warning(pop)
#endif

View File

@@ -72,8 +72,8 @@ namespace chaiscript
chaiscript::detail::Any m_obj;
void *m_data_ptr;
const void *m_const_data_ptr;
bool m_is_ref;
std::unique_ptr<std::map<std::string, Boxed_Value>> m_attrs;
bool m_is_ref;
};
struct Object_Data

View File

@@ -129,7 +129,7 @@ namespace chaiscript
virtual Boxed_Value do_call(const std::vector<Boxed_Value> &params, const Type_Conversions &t_conversions) const = 0;
Proxy_Function_Base(std::vector<Type_Info> t_types, int t_arity)
: m_types(std::move(t_types)), m_has_arithmetic_param(false), m_arity(t_arity)
: m_types(std::move(t_types)), m_arity(t_arity), m_has_arithmetic_param(false)
{
for (size_t i = 1; i < m_types.size(); ++i)
{
@@ -175,8 +175,8 @@ namespace chaiscript
}
std::vector<Type_Info> m_types;
bool m_has_arithmetic_param;
int m_arity;
bool m_has_arithmetic_param;
};
}
@@ -220,11 +220,11 @@ namespace chaiscript
std::string t_description = "",
Proxy_Function t_guard = Proxy_Function())
: Proxy_Function_Base(build_param_type_list(t_arity), t_arity),
m_f(std::move(t_f)), m_arity(t_arity), m_description(std::move(t_description)), m_guard(std::move(t_guard)), m_parsenode(std::move(t_parsenode))
m_guard(std::move(t_guard)), m_parsenode(std::move(t_parsenode)), m_description(std::move(t_description)), m_f(std::move(t_f))
{
}
virtual ~Dynamic_Proxy_Function() {}
virtual ~Dynamic_Proxy_Function() = default;
virtual bool operator==(const Proxy_Function_Base &rhs) const CHAISCRIPT_OVERRIDE
{
@@ -311,11 +311,10 @@ namespace chaiscript
return types;
}
std::function<Boxed_Value (const std::vector<Boxed_Value> &)> m_f;
int m_arity;
std::string m_description;
Proxy_Function m_guard;
AST_NodePtr m_parsenode;
std::string m_description;
std::function<Boxed_Value (const std::vector<Boxed_Value> &)> m_f;
};
/**
@@ -591,7 +590,8 @@ namespace chaiscript
{
}
virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT {}
dispatch_error(const dispatch_error &) = default;
virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT = default;
std::vector<Boxed_Value> parameters;
std::vector<Const_Proxy_Function> functions;

View File

@@ -44,7 +44,9 @@ namespace chaiscript
{
}
virtual ~bad_boxed_dynamic_cast() CHAISCRIPT_NOEXCEPT {}
bad_boxed_dynamic_cast(const bad_boxed_dynamic_cast &) = default;
virtual ~bad_boxed_dynamic_cast() CHAISCRIPT_NOEXCEPT = default;
};
class bad_boxed_type_cast : public bad_boxed_cast
@@ -66,7 +68,9 @@ namespace chaiscript
{
}
virtual ~bad_boxed_type_cast() CHAISCRIPT_NOEXCEPT {}
bad_boxed_type_cast(const bad_boxed_type_cast &) = default;
virtual ~bad_boxed_type_cast() CHAISCRIPT_NOEXCEPT = default;
};
}

View File

@@ -397,7 +397,8 @@ namespace chaiscript
: std::runtime_error("File Not Found: " + t_filename)
{ }
virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT {}
file_not_found_error(const file_not_found_error &) = default;
virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT = default;
};
}

View File

@@ -61,9 +61,8 @@ namespace chaiscript
{
}
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT
{
}
load_module_error(const load_module_error &) = default;
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT = default;
};
}

View File

@@ -223,8 +223,8 @@ namespace chaiscript
t_t->end.column = pos_col_stop;
if (is_deep) {
t_t->children.assign(m_match_stack.begin() + t_match_start, m_match_stack.end());
m_match_stack.erase(m_match_stack.begin() + t_match_start, m_match_stack.end());
t_t->children.assign(m_match_stack.begin() + static_cast<int>(t_match_start), m_match_stack.end());
m_match_stack.erase(m_match_stack.begin() + static_cast<int>(t_match_start), m_match_stack.end());
}
/// \todo fix the fact that a successful match that captured no ast_nodes doesn't have any real start position
@@ -1910,6 +1910,7 @@ namespace chaiscript
case(AST_Node_Type::Bitwise_Xor) :
case(AST_Node_Type::Bitwise_Or) :
case(AST_Node_Type::Comparison) :
assert(m_match_stack.size() > 1);
m_match_stack.erase(m_match_stack.begin() + m_match_stack.size() - 2, m_match_stack.begin() + m_match_stack.size() - 1);
build_match(std::make_shared<eval::Binary_Operator_AST_Node>(oper->text), prev_stack_top);
break;