Memory leak error fixes. Various compiler fixes.

This commit is contained in:
Jason Turner 2015-01-15 15:42:35 -07:00
parent 759d6fc42f
commit 9449fca22f
7 changed files with 16 additions and 9 deletions

View File

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

View File

@ -224,7 +224,7 @@ namespace chaiscript
{ {
} }
virtual ~Dynamic_Proxy_Function() = default; virtual ~Dynamic_Proxy_Function() {}
virtual bool operator==(const Proxy_Function_Base &rhs) const CHAISCRIPT_OVERRIDE virtual bool operator==(const Proxy_Function_Base &rhs) const CHAISCRIPT_OVERRIDE
{ {
@ -591,7 +591,7 @@ namespace chaiscript
} }
dispatch_error(const dispatch_error &) = default; dispatch_error(const dispatch_error &) = default;
virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT = default; virtual ~dispatch_error() CHAISCRIPT_NOEXCEPT {}
std::vector<Boxed_Value> parameters; std::vector<Boxed_Value> parameters;
std::vector<Const_Proxy_Function> functions; std::vector<Const_Proxy_Function> functions;

View File

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

View File

@ -398,7 +398,7 @@ namespace chaiscript
{ } { }
file_not_found_error(const file_not_found_error &) = default; file_not_found_error(const file_not_found_error &) = default;
virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT = default; virtual ~file_not_found_error() CHAISCRIPT_NOEXCEPT {}
}; };
} }

View File

@ -62,7 +62,7 @@ namespace chaiscript
} }
load_module_error(const load_module_error &) = default; load_module_error(const load_module_error &) = default;
virtual ~load_module_error() CHAISCRIPT_NOEXCEPT = default; virtual ~load_module_error() CHAISCRIPT_NOEXCEPT {}
}; };
} }

View File

@ -9,7 +9,7 @@ class TestBaseType
public: public:
TestBaseType() : val(10), const_val(15) { } TestBaseType() : val(10), const_val(15) { }
TestBaseType(int) : val(10), const_val(15) {} TestBaseType(int) : val(10), const_val(15) {}
TestBaseType(int *) : val(10), const_val(15) {} TestBaseType(int *i) : val(10), const_val(15) { }
TestBaseType(const TestBaseType &) = default; TestBaseType(const TestBaseType &) = default;
virtual ~TestBaseType() {} virtual ~TestBaseType() {}
virtual int func() { return 0; } virtual int func() { return 0; }
@ -100,9 +100,11 @@ std::string hello_world()
return "Hello World"; return "Hello World";
} }
int global_i = 1;
int *get_new_int() int *get_new_int()
{ {
return new int(1); return &global_i;
} }
// MSVC doesn't like that we are using C++ return types from our C declared module // MSVC doesn't like that we are using C++ return types from our C declared module

View File

@ -265,20 +265,25 @@ bool pointer_test(const T& default_value, const T& new_value)
if (p != (*result) ) { if (p != (*result) ) {
std::cerr << "Pointer passed in different than one returned\n"; std::cerr << "Pointer passed in different than one returned\n";
delete p;
return false; return false;
} }
if (*p != *(*result) ) { if (*p != *(*result) ) {
std::cerr << "Somehow dereferenced pointer values are not the same?\n"; std::cerr << "Somehow dereferenced pointer values are not the same?\n";
delete p;
return false; return false;
} }
delete p;
return true; return true;
} catch (const exception::bad_boxed_cast &) { } catch (const exception::bad_boxed_cast &) {
std::cerr << "Bad boxed cast performing ** to ** test\n"; std::cerr << "Bad boxed cast performing ** to ** test\n";
delete p;
return false; return false;
} catch (...) { } catch (...) {
std::cerr << "Unknown exception performing ** to ** test\n"; std::cerr << "Unknown exception performing ** to ** test\n";
delete p;
return false; return false;
} }