Commit eb676bf0 authored by Davis King's avatar Davis King

Just fixes compiler warnings in gcc 4.8 and clang 3.4.

parent e9c6a774
...@@ -38,14 +38,24 @@ namespace dlib ...@@ -38,14 +38,24 @@ namespace dlib
template <typename T, typename U> struct assert_are_not_same_type {enum{value=1}; }; template <typename T, typename U> struct assert_are_not_same_type {enum{value=1}; };
template <typename T> struct assert_are_not_same_type<T,T> {}; template <typename T> struct assert_are_not_same_type<T,T> {};
} }
// gcc 4.8 will warn about unused typedefs. But we use typedefs in some of the compile
// time assert macros so we need to make it not complain about them "not being used".
#ifdef __GNUC__
#define DLIB_NO_WARN_UNUSED __attribute__ ((unused))
#else
#define DLIB_NO_WARN_UNUSED
#endif
#define COMPILE_TIME_ASSERT(expression) \ #define COMPILE_TIME_ASSERT(expression) \
typedef char BOOST_JOIN(DLIB_CTA, __LINE__)[::dlib::compile_time_assert<(bool)(expression)>::value] DLIB_NO_WARN_UNUSED typedef char BOOST_JOIN(DLIB_CTA, __LINE__)[::dlib::compile_time_assert<(bool)(expression)>::value]
#define ASSERT_ARE_SAME_TYPE(type1, type2) \ #define ASSERT_ARE_SAME_TYPE(type1, type2) \
typedef char BOOST_JOIN(DLIB_AAST, __LINE__)[::dlib::assert_are_same_type<type1,type2>::value] DLIB_NO_WARN_UNUSED typedef char BOOST_JOIN(DLIB_AAST, __LINE__)[::dlib::assert_are_same_type<type1,type2>::value]
#define ASSERT_ARE_NOT_SAME_TYPE(type1, type2) \ #define ASSERT_ARE_NOT_SAME_TYPE(type1, type2) \
typedef char BOOST_JOIN(DLIB_AANST, __LINE__)[::dlib::assert_are_not_same_type<type1,type2>::value] DLIB_NO_WARN_UNUSED typedef char BOOST_JOIN(DLIB_AANST, __LINE__)[::dlib::assert_are_not_same_type<type1,type2>::value]
// ----------------------------- // -----------------------------
...@@ -117,7 +127,7 @@ namespace dlib ...@@ -117,7 +127,7 @@ namespace dlib
// Use the fact that in C++03 you can't put non-PODs into a union. // Use the fact that in C++03 you can't put non-PODs into a union.
#define DLIB_ASSERT_HAS_STANDARD_LAYOUT(type) \ #define DLIB_ASSERT_HAS_STANDARD_LAYOUT(type) \
union BOOST_JOIN(DAHSL_,__LINE__) { type TYPE_NOT_STANDARD_LAYOUT; }; \ union BOOST_JOIN(DAHSL_,__LINE__) { type TYPE_NOT_STANDARD_LAYOUT; }; \
typedef char BOOST_JOIN(DAHSL2_,__LINE__)[sizeof(BOOST_JOIN(DAHSL_,__LINE__))]; DLIB_NO_WARN_UNUSED typedef char BOOST_JOIN(DAHSL2_,__LINE__)[sizeof(BOOST_JOIN(DAHSL_,__LINE__))];
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -233,7 +233,6 @@ namespace dlib ...@@ -233,7 +233,6 @@ namespace dlib
const unsigned long sink const unsigned long sink
) const ) const
{ {
typedef typename flow_graph::edge_type edge_type;
typedef typename flow_graph::out_edge_iterator out_edge_iterator; typedef typename flow_graph::out_edge_iterator out_edge_iterator;
typedef typename flow_graph::in_edge_iterator in_edge_iterator; typedef typename flow_graph::in_edge_iterator in_edge_iterator;
...@@ -365,8 +364,6 @@ namespace dlib ...@@ -365,8 +364,6 @@ namespace dlib
) const ) const
{ {
typedef typename flow_graph::edge_type edge_type; typedef typename flow_graph::edge_type edge_type;
typedef typename flow_graph::out_edge_iterator out_edge_iterator;
typedef typename flow_graph::in_edge_iterator in_edge_iterator;
// used to indicate "no parent" // used to indicate "no parent"
const unsigned long nil = g.number_of_nodes(); const unsigned long nil = g.number_of_nodes();
...@@ -458,7 +455,6 @@ namespace dlib ...@@ -458,7 +455,6 @@ namespace dlib
- returns false - returns false
!*/ !*/
{ {
typedef typename flow_graph::edge_type edge_type;
typedef typename flow_graph::out_edge_iterator out_edge_iterator; typedef typename flow_graph::out_edge_iterator out_edge_iterator;
typedef typename flow_graph::in_edge_iterator in_edge_iterator; typedef typename flow_graph::in_edge_iterator in_edge_iterator;
......
...@@ -176,7 +176,6 @@ namespace dlib ...@@ -176,7 +176,6 @@ namespace dlib
template <typename T> template <typename T>
typename promote<T>::type square (const T& a) typename promote<T>::type square (const T& a)
{ {
typedef typename promote<T>::type type;
return static_cast<T>(a)*static_cast<T>(a); return static_cast<T>(a)*static_cast<T>(a);
} }
} }
......
...@@ -70,7 +70,6 @@ namespace dlib ...@@ -70,7 +70,6 @@ namespace dlib
typedef typename pixel_traits<typename in_image_type::type>::basic_pixel_type in_image_basic_pixel_type; typedef typename pixel_traits<typename in_image_type::type>::basic_pixel_type in_image_basic_pixel_type;
COMPILE_TIME_ASSERT( sizeof(in_image_basic_pixel_type) <= 2); COMPILE_TIME_ASSERT( sizeof(in_image_basic_pixel_type) <= 2);
typedef typename in_image_type::type in_pixel_type;
typedef typename out_image_type::type out_pixel_type; typedef typename out_image_type::type out_pixel_type;
// if there isn't any input image then don't do anything // if there isn't any input image then don't do anything
......
...@@ -448,7 +448,6 @@ namespace dlib ...@@ -448,7 +448,6 @@ namespace dlib
) )
{ {
using namespace dlib::impl; using namespace dlib::impl;
typedef typename in_image_type::type ptype;
std::vector<dlib::impl::segment_image_edge_data_T<diff_type> > rejected_edges; std::vector<dlib::impl::segment_image_edge_data_T<diff_type> > rejected_edges;
rejected_edges.reserve(sorted_edges.size()); rejected_edges.reserve(sorted_edges.size());
......
...@@ -345,11 +345,6 @@ namespace dlib ...@@ -345,11 +345,6 @@ namespace dlib
} }
}; };
#ifdef __GNUC__
#define DLIB_SHUT_UP_GCC_ABOUT_THIS_UNUSED_VARIABLE __attribute__ ((unused))
#else
#define DLIB_SHUT_UP_GCC_ABOUT_THIS_UNUSED_VARIABLE
#endif
// This is a macro to help us add overloads for the matrix_assign_blas_helper template. // This is a macro to help us add overloads for the matrix_assign_blas_helper template.
// Using this macro it is easy to add overloads for arbitrary matrix expressions. // Using this macro it is easy to add overloads for arbitrary matrix expressions.
#define DLIB_ADD_BLAS_BINDING(src_expression) \ #define DLIB_ADD_BLAS_BINDING(src_expression) \
...@@ -364,9 +359,9 @@ namespace dlib ...@@ -364,9 +359,9 @@ namespace dlib
const src_exp& src, \ const src_exp& src, \
typename src_exp::type alpha, \ typename src_exp::type alpha, \
bool add_to, \ bool add_to, \
bool DLIB_SHUT_UP_GCC_ABOUT_THIS_UNUSED_VARIABLE transpose \ bool DLIB_NO_WARN_UNUSED transpose \
) { \ ) { \
typedef typename dest_exp::type T; DLIB_NO_WARN_UNUSED typedef typename dest_exp::type T;
#define DLIB_END_BLAS_BINDING }}; #define DLIB_END_BLAS_BINDING }};
......
...@@ -1090,7 +1090,6 @@ convergence: ...@@ -1090,7 +1090,6 @@ convergence:
) )
{ {
using namespace nric; using namespace nric;
typedef typename EXP::mem_manager_type MM;
// you can't invert a non-square matrix // you can't invert a non-square matrix
COMPILE_TIME_ASSERT(matrix_exp<EXP>::NR == matrix_exp<EXP>::NC || COMPILE_TIME_ASSERT(matrix_exp<EXP>::NR == matrix_exp<EXP>::NC ||
matrix_exp<EXP>::NR == 0 || matrix_exp<EXP>::NR == 0 ||
...@@ -1306,7 +1305,6 @@ convergence: ...@@ -1306,7 +1305,6 @@ convergence:
); );
typedef typename matrix_exp<EXP>::matrix_type matrix_type; typedef typename matrix_exp<EXP>::matrix_type matrix_type;
typedef typename matrix_type::type type;
matrix_type m(A); matrix_type m(A);
...@@ -1351,7 +1349,6 @@ convergence: ...@@ -1351,7 +1349,6 @@ convergence:
); );
typedef typename matrix_exp<EXP>::matrix_type matrix_type; typedef typename matrix_exp<EXP>::matrix_type matrix_type;
typedef typename matrix_type::type type;
matrix_type m(A); matrix_type m(A);
...@@ -1646,8 +1643,6 @@ convergence: ...@@ -1646,8 +1643,6 @@ convergence:
<< "\n\tm.nr(): " << m.nr() << "\n\tm.nr(): " << m.nr()
<< "\n\tm.nc(): " << m.nc() << "\n\tm.nc(): " << m.nc()
); );
typedef typename matrix_exp<EXP>::type type;
typedef typename matrix_exp<EXP>::mem_manager_type MM;
return lu_decomposition<EXP>(m).det(); return lu_decomposition<EXP>(m).det();
} }
...@@ -1663,7 +1658,6 @@ convergence: ...@@ -1663,7 +1658,6 @@ convergence:
) )
{ {
COMPILE_TIME_ASSERT(matrix_exp<EXP>::NR == matrix_exp<EXP>::NC); COMPILE_TIME_ASSERT(matrix_exp<EXP>::NR == matrix_exp<EXP>::NC);
typedef typename matrix_exp<EXP>::type type;
return m(0); return m(0);
} }
...@@ -1679,7 +1673,6 @@ convergence: ...@@ -1679,7 +1673,6 @@ convergence:
) )
{ {
COMPILE_TIME_ASSERT(matrix_exp<EXP>::NR == matrix_exp<EXP>::NC); COMPILE_TIME_ASSERT(matrix_exp<EXP>::NR == matrix_exp<EXP>::NC);
typedef typename matrix_exp<EXP>::type type;
return m(0,0)*m(1,1) - m(0,1)*m(1,0); return m(0,0)*m(1,1) - m(0,1)*m(1,0);
} }
......
...@@ -255,8 +255,6 @@ namespace dlib ...@@ -255,8 +255,6 @@ namespace dlib
typedef typename funct_model::column_vector T; typedef typename funct_model::column_vector T;
typedef typename T::type type; typedef typename T::type type;
typedef typename T::mem_manager_type mem_manager_type;
typedef typename T::layout_type layout_type;
typename funct_model::general_matrix h; typename funct_model::general_matrix h;
typename funct_model::column_vector g, p, d; typename funct_model::column_vector g, p, d;
......
// Copyright (C) 2007 Davis E. King (davis@dlib.net) // Copyright (C) 2007 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license. // License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_SVm_HEADER #ifndef DLIB_SVm_HEADER
#define DLIB_SVM_HEADER #define DLIB_SVm_HEADER
#include "svm/svm_rank_trainer.h" #include "svm/svm_rank_trainer.h"
#include "svm/svm.h" #include "svm/svm.h"
......
...@@ -25,7 +25,6 @@ namespace dlib ...@@ -25,7 +25,6 @@ namespace dlib
const std::vector<label_type>& y_test const std::vector<label_type>& y_test
) )
{ {
typedef typename dec_funct_type::mem_manager_type mem_manager_type;
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT( is_learning_problem(x_test,y_test) == true, DLIB_ASSERT( is_learning_problem(x_test,y_test) == true,
......
...@@ -25,7 +25,6 @@ namespace dlib ...@@ -25,7 +25,6 @@ namespace dlib
const std::vector<label_type>& y_test const std::vector<label_type>& y_test
) )
{ {
typedef typename reg_funct_type::mem_manager_type mem_manager_type;
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT( is_learning_problem(x_test,y_test) == true, DLIB_ASSERT( is_learning_problem(x_test,y_test) == true,
...@@ -67,7 +66,6 @@ namespace dlib ...@@ -67,7 +66,6 @@ namespace dlib
const long folds const long folds
) )
{ {
typedef typename trainer_type::mem_manager_type mem_manager_type;
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(is_learning_problem(x,y) == true && DLIB_ASSERT(is_learning_problem(x,y) == true &&
......
...@@ -33,7 +33,6 @@ namespace dlib ...@@ -33,7 +33,6 @@ namespace dlib
*/ */
typedef typename kernel_type::scalar_type scalar_type; typedef typename kernel_type::scalar_type scalar_type;
typedef typename kernel_type::sample_type sample_type;
typedef typename kernel_type::mem_manager_type mm; typedef typename kernel_type::mem_manager_type mm;
...@@ -172,7 +171,6 @@ namespace dlib ...@@ -172,7 +171,6 @@ namespace dlib
*/ */
typedef typename kernel_type::scalar_type scalar_type; typedef typename kernel_type::scalar_type scalar_type;
typedef typename kernel_type::sample_type sample_type;
typedef typename kernel_type::mem_manager_type mm; typedef typename kernel_type::mem_manager_type mm;
// make sure requires clause is not broken // make sure requires clause is not broken
...@@ -374,7 +372,6 @@ namespace dlib ...@@ -374,7 +372,6 @@ namespace dlib
bool verbose bool verbose
) )
{ {
typedef typename sample_matrix_type::type sample_type;
using namespace std; using namespace std;
if (verbose) if (verbose)
......
...@@ -280,7 +280,6 @@ namespace dlib ...@@ -280,7 +280,6 @@ namespace dlib
} }
typedef matrix<scalar_type,0,1,mem_manager_type> column_matrix_type; typedef matrix<scalar_type,0,1,mem_manager_type> column_matrix_type;
typedef matrix<scalar_type,0,0,mem_manager_type> general_matrix_type;
running_stats<scalar_type> rs; running_stats<scalar_type> rs;
......
...@@ -541,8 +541,6 @@ namespace dlib ...@@ -541,8 +541,6 @@ namespace dlib
const in_scalar_vector_type& y const in_scalar_vector_type& y
) const ) const
{ {
typedef typename decision_function<kernel_type>::sample_vector_type sample_vector_type;
typedef typename decision_function<kernel_type>::scalar_vector_type scalar_vector_type;
dlib::rand rnd; dlib::rand rnd;
...@@ -591,8 +589,6 @@ namespace dlib ...@@ -591,8 +589,6 @@ namespace dlib
const in_scalar_vector_type& y const in_scalar_vector_type& y
) const ) const
{ {
typedef typename decision_function<kernel_type>::sample_vector_type sample_vector_type;
typedef typename decision_function<kernel_type>::scalar_vector_type scalar_vector_type;
dlib::rand rnd; dlib::rand rnd;
......
...@@ -100,7 +100,6 @@ namespace dlib ...@@ -100,7 +100,6 @@ namespace dlib
) const ) const
{ {
typedef typename decision_function<kernel_type>::scalar_vector_type scalar_vector_type; typedef typename decision_function<kernel_type>::scalar_vector_type scalar_vector_type;
typedef typename decision_function<kernel_type>::sample_vector_type sample_vector_type;
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(is_learning_problem(x,y), DLIB_ASSERT(is_learning_problem(x,y),
......
...@@ -72,7 +72,6 @@ namespace dlib ...@@ -72,7 +72,6 @@ namespace dlib
<< "\n\t eps: " << eps << "\n\t eps: " << eps
); );
typedef typename kernel_type::sample_type sample_type;
typedef typename kernel_type::scalar_type scalar_type; typedef typename kernel_type::scalar_type scalar_type;
typedef typename kernel_type::mem_manager_type mm_type; typedef typename kernel_type::mem_manager_type mm_type;
......
...@@ -109,9 +109,6 @@ namespace dlib ...@@ -109,9 +109,6 @@ namespace dlib
const in_scalar_vector_type& y_test const in_scalar_vector_type& y_test
) )
{ {
typedef typename dec_funct_type::sample_type sample_type;
typedef typename dec_funct_type::mem_manager_type mem_manager_type;
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT( is_binary_classification_problem(x_test,y_test) == true, DLIB_ASSERT( is_binary_classification_problem(x_test,y_test) == true,
......
...@@ -90,10 +90,7 @@ namespace dlib ...@@ -90,10 +90,7 @@ namespace dlib
{ {
using namespace dlib::cvtti_helpers; using namespace dlib::cvtti_helpers;
typedef typename trainer_type::scalar_type scalar_type; typedef typename trainer_type::scalar_type scalar_type;
typedef typename trainer_type::sample_type sample_type;
typedef typename trainer_type::mem_manager_type mem_manager_type; typedef typename trainer_type::mem_manager_type mem_manager_type;
typedef matrix<sample_type,0,1,mem_manager_type> sample_vector_type;
typedef matrix<scalar_type,0,1,mem_manager_type> scalar_vector_type;
// make sure requires clause is not broken // make sure requires clause is not broken
DLIB_ASSERT(is_binary_classification_problem(x,y) == true && DLIB_ASSERT(is_binary_classification_problem(x,y) == true &&
......
...@@ -32,7 +32,6 @@ namespace ...@@ -32,7 +32,6 @@ namespace
!*/ !*/
{ {
typedef typename clp::char_type ct; typedef typename clp::char_type ct;
typedef typename clp::string_type string_type;
......
...@@ -667,7 +667,6 @@ namespace ...@@ -667,7 +667,6 @@ namespace
const long M = 3; const long M = 3;
const long N = 3; const long N = 3;
typedef matrix<double,0,0> mat;
matrix<double,0,0,default_memory_manager, column_major_layout> a(M,N); matrix<double,0,0,default_memory_manager, column_major_layout> a(M,N);
for (long r = 0; r < a.nr(); ++r) for (long r = 0; r < a.nr(); ++r)
......
...@@ -634,7 +634,6 @@ namespace ...@@ -634,7 +634,6 @@ namespace
- runs tests on the matrix stuff compliance with the specs - runs tests on the matrix stuff compliance with the specs
!*/ !*/
{ {
typedef memory_manager_stateless<char>::kernel_2_2a MM;
print_spinner(); print_spinner();
......
...@@ -32,7 +32,6 @@ namespace ...@@ -32,7 +32,6 @@ namespace
- runs tests on the matrix stuff compliance with the specs - runs tests on the matrix stuff compliance with the specs
!*/ !*/
{ {
typedef memory_manager_stateless<char>::kernel_2_2a MM;
print_spinner(); print_spinner();
{ {
......
...@@ -387,7 +387,6 @@ namespace ...@@ -387,7 +387,6 @@ namespace
print_spinner(); print_spinner();
++thetime; ++thetime;
typedef matrix<double,0,1> sample_type;
//dlog << LINFO << "time seed: " << thetime; //dlog << LINFO << "time seed: " << thetime;
//rnd.set_seed(cast_to_string(thetime)); //rnd.set_seed(cast_to_string(thetime));
......
...@@ -65,7 +65,7 @@ namespace ...@@ -65,7 +65,7 @@ namespace
int last = -1; int last = -1;
for (unsigned long i = 0; i < proc1_count; ++i) for (unsigned long i = 0; i < proc1_count; ++i)
{ {
int cur; int cur=0;
DLIB_TEST(p.dequeue(cur) == true); DLIB_TEST(p.dequeue(cur) == true);
DLIB_TEST(last + 1 == cur); DLIB_TEST(last + 1 == cur);
last = cur; last = cur;
......
...@@ -456,8 +456,6 @@ namespace ...@@ -456,8 +456,6 @@ namespace
typename image_type1::type thresh typename image_type1::type thresh
) )
{ {
typedef typename image_type1::type pixel_type;
const rectangle area = get_rect(img); const rectangle area = get_rect(img);
for (long r = 0; r < img.nr(); ++r) for (long r = 0; r < img.nr(); ++r)
{ {
......
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