Skip to content

Commit f95ca75

Browse files
committed
Clean up more warnings with stricter warning levels
1 parent 41a45ce commit f95ca75

14 files changed

+71
-48
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ else()
155155
add_definitions(-Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Woverloaded-virtual -pedantic ${CPP11_FLAG})
156156

157157
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
158-
add_definitions(-Weverything -Wno-c++98-compat -Wno-documentation -Wno-switch-enum -Wno-weak-vtables)
158+
add_definitions(-Weverything -Wno-c++98-compat -Wno-documentation -Wno-switch-enum -Wno-weak-vtables -Wno-sign-conversion -Wno-missing-prototypes -Wno-padded)
159159
else()
160160
add_definitions(-Wnoexcept)
161161
endif()

include/chaiscript/dispatchkit/bad_boxed_cast.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ namespace chaiscript
4545
{
4646
}
4747

48-
virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT {}
48+
bad_boxed_cast(const bad_boxed_cast &) = default;
49+
virtual ~bad_boxed_cast() CHAISCRIPT_NOEXCEPT = default;
4950

5051
/// \brief Description of what error occurred
5152
virtual const char * what() const CHAISCRIPT_NOEXCEPT CHAISCRIPT_OVERRIDE

include/chaiscript/dispatchkit/bootstrap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ namespace chaiscript
298298
}
299299
}
300300

301-
static void throw_exception(const Boxed_Value &bv) {
301+
static void throw_exception [[ noreturn ]] (const Boxed_Value &bv) {
302302
throw bv;
303303
}
304304

include/chaiscript/dispatchkit/boxed_number.hpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,22 @@ namespace chaiscript
3333
#pragma warning(disable : 4244 4018 4389 4146 4365)
3434
#endif
3535

36+
37+
#ifdef __GNUC__
38+
#pragma GCC diagnostic push
39+
#pragma GCC diagnostic ignored "-Wsign-compare"
40+
#pragma GCC diagnostic ignored "-Wfloat-equal"
41+
#pragma GCC diagnostic ignored "-Wconversion"
42+
#pragma GCC diagnostic ignored "-Wsign-conversion"
43+
#endif
44+
3645
/// \brief Represents any numeric type, generically. Used internally for generic operations between POD values
3746
class Boxed_Number
3847
{
3948
private:
4049
struct boolean
4150
{
4251

43-
#ifdef __GNUC__
44-
#pragma GCC diagnostic ignored "-Wsign-compare"
45-
#endif
4652
template<typename T, typename U>
4753
static Boxed_Value go(Operators::Opers t_oper, const T &t, const U &u, const Boxed_Value &)
4854
{
@@ -850,14 +856,18 @@ namespace chaiscript
850856
struct Cast_Helper<const Boxed_Number &> : Cast_Helper<Boxed_Number>
851857
{
852858
};
853-
859+
854860
/// Cast_Helper for converting from Boxed_Value to Boxed_Number
855861
template<>
856862
struct Cast_Helper<const Boxed_Number> : Cast_Helper<Boxed_Number>
857863
{
858-
};
864+
};
859865
}
860866

867+
#ifdef __GNUC__
868+
#pragma GCC diagnostic pop
869+
#endif
870+
861871
#ifdef CHAISCRIPT_MSVC
862872
#pragma warning(pop)
863873
#endif

include/chaiscript/dispatchkit/boxed_value.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ namespace chaiscript
7272
chaiscript::detail::Any m_obj;
7373
void *m_data_ptr;
7474
const void *m_const_data_ptr;
75-
bool m_is_ref;
7675
std::unique_ptr<std::map<std::string, Boxed_Value>> m_attrs;
76+
bool m_is_ref;
7777
};
7878

7979
struct Object_Data

include/chaiscript/dispatchkit/proxy_functions.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace chaiscript
129129
virtual Boxed_Value do_call(const std::vector<Boxed_Value> &params, const Type_Conversions &t_conversions) const = 0;
130130

131131
Proxy_Function_Base(std::vector<Type_Info> t_types, int t_arity)
132-
: m_types(std::move(t_types)), m_has_arithmetic_param(false), m_arity(t_arity)
132+
: m_types(std::move(t_types)), m_arity(t_arity), m_has_arithmetic_param(false)
133133
{
134134
for (size_t i = 1; i < m_types.size(); ++i)
135135
{
@@ -175,8 +175,8 @@ namespace chaiscript
175175
}
176176

177177
std::vector<Type_Info> m_types;
178-
bool m_has_arithmetic_param;
179178
int m_arity;
179+
bool m_has_arithmetic_param;
180180
};
181181
}
182182

@@ -220,11 +220,11 @@ namespace chaiscript
220220
std::string t_description = "",
221221
Proxy_Function t_guard = Proxy_Function())
222222
: Proxy_Function_Base(build_param_type_list(t_arity), t_arity),
223-
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))
223+
m_guard(std::move(t_guard)), m_parsenode(std::move(t_parsenode)), m_description(std::move(t_description)), m_f(std::move(t_f))
224224
{
225225
}
226226

227-
virtual ~Dynamic_Proxy_Function() {}
227+
virtual ~Dynamic_Proxy_Function() = default;
228228

229229
virtual bool operator==(const Proxy_Function_Base &rhs) const CHAISCRIPT_OVERRIDE
230230
{
@@ -311,11 +311,10 @@ namespace chaiscript
311311
return types;
312312
}
313313

314-
std::function<Boxed_Value (const std::vector<Boxed_Value> &)> m_f;
315-
int m_arity;
316-
std::string m_description;
317314
Proxy_Function m_guard;
318315
AST_NodePtr m_parsenode;
316+
std::string m_description;
317+
std::function<Boxed_Value (const std::vector<Boxed_Value> &)> m_f;
319318
};
320319

321320
/**
@@ -591,7 +590,8 @@ namespace chaiscript
591590
{
592591
}
593592

594-
virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT {}
593+
dispatch_error(const dispatch_error &) = default;
594+
virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT = default;
595595

596596
std::vector<Boxed_Value> parameters;
597597
std::vector<Const_Proxy_Function> functions;

include/chaiscript/dispatchkit/type_conversions.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ namespace chaiscript
4444
{
4545
}
4646

47-
virtual ~bad_boxed_dynamic_cast() CHAISCRIPT_NOEXCEPT {}
47+
bad_boxed_dynamic_cast(const bad_boxed_dynamic_cast &) = default;
48+
49+
virtual ~bad_boxed_dynamic_cast() CHAISCRIPT_NOEXCEPT = default;
4850
};
4951

5052
class bad_boxed_type_cast : public bad_boxed_cast
@@ -66,7 +68,9 @@ namespace chaiscript
6668
{
6769
}
6870

69-
virtual ~bad_boxed_type_cast() CHAISCRIPT_NOEXCEPT {}
71+
bad_boxed_type_cast(const bad_boxed_type_cast &) = default;
72+
73+
virtual ~bad_boxed_type_cast() CHAISCRIPT_NOEXCEPT = default;
7074
};
7175
}
7276

include/chaiscript/language/chaiscript_common.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ namespace chaiscript
397397
: std::runtime_error("File Not Found: " + t_filename)
398398
{ }
399399

400-
virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT {}
400+
file_not_found_error(const file_not_found_error &) = default;
401+
virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT = default;
401402
};
402403

403404
}

include/chaiscript/language/chaiscript_engine.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ namespace chaiscript
6161
{
6262
}
6363

64-
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT
65-
{
66-
}
64+
load_module_error(const load_module_error &) = default;
65+
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT = default;
6766
};
6867
}
6968

include/chaiscript/language/chaiscript_parser.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ namespace chaiscript
223223
t_t->end.column = pos_col_stop;
224224

225225
if (is_deep) {
226-
t_t->children.assign(m_match_stack.begin() + t_match_start, m_match_stack.end());
227-
m_match_stack.erase(m_match_stack.begin() + t_match_start, m_match_stack.end());
226+
t_t->children.assign(m_match_stack.begin() + static_cast<int>(t_match_start), m_match_stack.end());
227+
m_match_stack.erase(m_match_stack.begin() + static_cast<int>(t_match_start), m_match_stack.end());
228228
}
229229

230230
/// \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
19101910
case(AST_Node_Type::Bitwise_Xor) :
19111911
case(AST_Node_Type::Bitwise_Or) :
19121912
case(AST_Node_Type::Comparison) :
1913+
assert(m_match_stack.size() > 1);
19131914
m_match_stack.erase(m_match_stack.begin() + m_match_stack.size() - 2, m_match_stack.begin() + m_match_stack.size() - 1);
19141915
build_match(std::make_shared<eval::Binary_Operator_AST_Node>(oper->text), prev_stack_top);
19151916
break;

0 commit comments

Comments
 (0)