Commit 86614971 authored by Davis King's avatar Davis King

Fixed a bunch of warnings in visual studio 2015.

parent 16ea6f11
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
// This warning happens often in generic code that works with functions and isn't useful. // This warning happens often in generic code that works with functions and isn't useful.
#pragma warning(disable : 4180) #pragma warning(disable : 4180)
// Disable "warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)"
#pragma warning(disable : 4290)
#endif #endif
#ifdef __BORLANDC__ #ifdef __BORLANDC__
......
...@@ -35,7 +35,7 @@ namespace dlib ...@@ -35,7 +35,7 @@ namespace dlib
const static unsigned int max = 4096; const static unsigned int max = 4096;
const static float logvals[max] = { const static double logvals[max] = {
4.079, 3.905, 3.8, 3.723, 3.663, 3.613, 3.57, 3.532, 3.499, 3.468, 4.079, 3.905, 3.8, 3.723, 3.663, 3.613, 3.57, 3.532, 3.499, 3.468,
3.441, 3.416, 3.392, 3.37, 3.35, 3.33, 3.312, 3.295, 3.278, 3.263, 3.441, 3.416, 3.392, 3.37, 3.35, 3.33, 3.312, 3.295, 3.278, 3.263,
3.248, 3.233, 3.219, 3.206, 3.193, 3.181, 3.169, 3.158, 3.147, 3.136, 3.248, 3.233, 3.219, 3.206, 3.193, 3.181, 3.169, 3.158, 3.147, 3.136,
...@@ -447,7 +447,7 @@ namespace dlib ...@@ -447,7 +447,7 @@ namespace dlib
0.08566, 0.08275, 0.07974, 0.0766, 0.07334, 0.06992, 0.06633, 0.06253, 0.05849, 0.05415, 0.08566, 0.08275, 0.07974, 0.0766, 0.07334, 0.06992, 0.06633, 0.06253, 0.05849, 0.05415,
0.04943, 0.0442, 0.03828, 0.03125, 0.0221, -0}; 0.04943, 0.0442, 0.03828, 0.03125, 0.0221, -0};
const static float cosvals[max] = { const static double cosvals[max] = {
1, 1, 1, 1, 1, 1, 0.9999, 0.9999, 0.9999, 0.9999, 1, 1, 1, 1, 1, 1, 0.9999, 0.9999, 0.9999, 0.9999,
0.9999, 0.9998, 0.9998, 0.9998, 0.9997, 0.9997, 0.9997, 0.9996, 0.9996, 0.9995, 0.9999, 0.9998, 0.9998, 0.9998, 0.9997, 0.9997, 0.9997, 0.9996, 0.9996, 0.9995,
0.9995, 0.9994, 0.9994, 0.9993, 0.9993, 0.9992, 0.9991, 0.9991, 0.999, 0.9989, 0.9995, 0.9994, 0.9994, 0.9993, 0.9993, 0.9992, 0.9991, 0.9991, 0.999, 0.9989,
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "drawable.h" #include "drawable.h"
#include <algorithm> #include <algorithm>
#include <iostream>
namespace dlib namespace dlib
{ {
...@@ -518,11 +519,20 @@ namespace dlib ...@@ -518,11 +519,20 @@ namespace dlib
~drawable ( ~drawable (
) )
{ {
DLIB_ASSERT(events_are_enabled() == false, try
"\tdrawable::~drawable()" {
<< "\n\tYou must disable events for drawable objects in their destructor by calling disable_events()." DLIB_ASSERT(events_are_enabled() == false,
<< "\n\tthis: " << this "\tdrawable::~drawable()"
); << "\n\tYou must disable events for drawable objects in their destructor by calling disable_events()."
<< "\n\tthis: " << this
);
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
assert(false);
abort();
}
disable_events(); disable_events();
} }
......
...@@ -1605,7 +1605,7 @@ namespace dlib ...@@ -1605,7 +1605,7 @@ namespace dlib
literal_assign_helper(const literal_assign_helper& item) : m(item.m), r(item.r), c(item.c), has_been_used(false) {} literal_assign_helper(const literal_assign_helper& item) : m(item.m), r(item.r), c(item.c), has_been_used(false) {}
explicit literal_assign_helper(matrix* m_): m(m_), r(0), c(0),has_been_used(false) {next();} explicit literal_assign_helper(matrix* m_): m(m_), r(0), c(0),has_been_used(false) {next();}
~literal_assign_helper() ~literal_assign_helper() throw (std::exception)
{ {
DLIB_CASSERT(!has_been_used || r == m->nr(), DLIB_CASSERT(!has_been_used || r == m->nr(),
"You have used the matrix comma based assignment incorrectly by failing to\n" "You have used the matrix comma based assignment incorrectly by failing to\n"
......
...@@ -28,11 +28,20 @@ namespace dlib ...@@ -28,11 +28,20 @@ namespace dlib
~multithreaded_object ( ~multithreaded_object (
) )
{ {
DLIB_ASSERT(number_of_threads_alive() == 0, try
"\tmultithreaded_object::~multithreaded_object()" {
<< "\n\tYou have let a multithreaded object destruct itself before terminating its threads" DLIB_ASSERT(number_of_threads_alive() == 0,
<< "\n\tthis: " << this "\tmultithreaded_object::~multithreaded_object()"
); << "\n\tYou have let a multithreaded object destruct itself before terminating its threads"
<< "\n\tthis: " << this
);
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
assert(false);
abort();
}
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -29,11 +29,20 @@ namespace dlib ...@@ -29,11 +29,20 @@ namespace dlib
~threaded_object ( ~threaded_object (
) )
{ {
DLIB_ASSERT(is_alive() == false, try
"\tthreaded_object::~threaded_object()" {
<< "\n\tYou have let a threaded object destruct itself before terminating its thread" DLIB_ASSERT(is_alive() == false,
<< "\n\tthis: " << this "\tthreaded_object::~threaded_object()"
); << "\n\tYou have let a threaded object destruct itself before terminating its thread"
<< "\n\tthis: " << this
);
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
assert(false);
abort();
}
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment