mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-07 01:06:54 +08:00
Fix clang warnings, fix misplaced noexcept
This commit is contained in:
parent
3f8b697e9e
commit
7f6f1d8a59
@ -191,7 +191,7 @@ else()
|
|||||||
add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -pedantic ${CPP14_FLAG})
|
add_definitions(-Wall -Wextra -Wconversion -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wcast-qual -Wunused -Woverloaded-virtual -pedantic ${CPP14_FLAG})
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
add_definitions(-Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-documentation -Wno-switch-enum -Wno-weak-vtables -Wno-missing-prototypes -Wno-padded -Wno-missing-noreturn -Wno-exit-time-destructors -Wno-documentation-unknown-command)
|
add_definitions(-Weverything -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-documentation -Wno-switch-enum -Wno-weak-vtables -Wno-missing-prototypes -Wno-padded -Wno-missing-noreturn -Wno-exit-time-destructors -Wno-documentation-unknown-command -Wno-unused-template -Wno-undef )
|
||||||
else()
|
else()
|
||||||
add_definitions(-Wnoexcept)
|
add_definitions(-Wnoexcept)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -26,7 +26,7 @@ namespace chaiscript
|
|||||||
const auto extent = std::extent<T>::value;
|
const auto extent = std::extent<T>::value;
|
||||||
m.add(user_type<T>(), type);
|
m.add(user_type<T>(), type);
|
||||||
m.add(fun(
|
m.add(fun(
|
||||||
[extent](T& t, size_t index)->ReturnType &{
|
[](T& t, size_t index)->ReturnType &{
|
||||||
if (extent > 0 && index >= extent) {
|
if (extent > 0 && index >= extent) {
|
||||||
throw std::range_error("Array index out of range. Received: " + std::to_string(index) + " expected < " + std::to_string(extent));
|
throw std::range_error("Array index out of range. Received: " + std::to_string(index) + " expected < " + std::to_string(extent));
|
||||||
} else {
|
} else {
|
||||||
@ -37,7 +37,7 @@ namespace chaiscript
|
|||||||
);
|
);
|
||||||
|
|
||||||
m.add(fun(
|
m.add(fun(
|
||||||
[extent](const T &t, size_t index)->const ReturnType &{
|
[](const T &t, size_t index)->const ReturnType &{
|
||||||
if (extent > 0 && index >= extent) {
|
if (extent > 0 && index >= extent) {
|
||||||
throw std::range_error("Array index out of range. Received: " + std::to_string(index) + " expected < " + std::to_string(extent));
|
throw std::range_error("Array index out of range. Received: " + std::to_string(index) + " expected < " + std::to_string(extent));
|
||||||
} else {
|
} else {
|
||||||
@ -48,7 +48,7 @@ namespace chaiscript
|
|||||||
);
|
);
|
||||||
|
|
||||||
m.add(fun(
|
m.add(fun(
|
||||||
[extent](const T &) {
|
[](const T &) {
|
||||||
return extent;
|
return extent;
|
||||||
}), "size");
|
}), "size");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -369,7 +369,7 @@ namespace chaiscript
|
|||||||
&& this->m_param_types == prhs->m_param_types);
|
&& this->m_param_types == prhs->m_param_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool call_match(const std::vector<Boxed_Value> &vals, const Type_Conversions_State &t_conversions) const noexcept override
|
bool call_match(const std::vector<Boxed_Value> &vals, const Type_Conversions_State &t_conversions) const override
|
||||||
{
|
{
|
||||||
return call_match_internal(vals, t_conversions).first;
|
return call_match_internal(vals, t_conversions).first;
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
// first result: is a match
|
// first result: is a match
|
||||||
// second result: needs conversions
|
// second result: needs conversions
|
||||||
std::pair<bool, bool> call_match_internal(const std::vector<Boxed_Value> &vals, const Type_Conversions_State &t_conversions) const noexcept
|
std::pair<bool, bool> call_match_internal(const std::vector<Boxed_Value> &vals, const Type_Conversions_State &t_conversions) const
|
||||||
{
|
{
|
||||||
const auto comparison_result = [&](){
|
const auto comparison_result = [&](){
|
||||||
if (m_arity < 0) {
|
if (m_arity < 0) {
|
||||||
|
|||||||
@ -78,7 +78,7 @@ int to_int(TestEnum t)
|
|||||||
class TestDerivedType : public TestBaseType
|
class TestDerivedType : public TestBaseType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~TestDerivedType() {}
|
~TestDerivedType() override {}
|
||||||
TestDerivedType(const TestDerivedType &) = default;
|
TestDerivedType(const TestDerivedType &) = default;
|
||||||
TestDerivedType() = default;
|
TestDerivedType() = default;
|
||||||
virtual int func() override { return 1; }
|
virtual int func() override { return 1; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user