Use make_optional; initialize

This commit is contained in:
Andreas Fabri 2016-01-29 09:45:47 +01:00
parent 6d25c01c5c
commit b841965dbe
4 changed files with 104 additions and 2 deletions

View File

@ -627,8 +627,9 @@ _merge_two_intervals(Edge_const_handle e1, bool is_leftmost1,
// This is the rightmost vertex in the current minimization diagram (out_d). // This is the rightmost vertex in the current minimization diagram (out_d).
// The intersection points/curves that interest us are the ones in // The intersection points/curves that interest us are the ones in
// [v_leftmost, v]. // [v_leftmost, v].
// Without using make_optional we get a "maybe uninitialized" warning with gcc -Wall
boost::optional<Vertex_const_handle> v_leftmost = boost::optional<Vertex_const_handle> v_leftmost =
boost::optional<Vertex_const_handle>(); boost::make_optional(false, Vertex_const_handle());
if (is_leftmost1 == true) { if (is_leftmost1 == true) {
if (is_leftmost2 == false) if (is_leftmost2 == false)

View File

@ -65,6 +65,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates {
// but Lazy ones. // but Lazy ones.
double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, alpha; double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, alpha;
init_double(px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, alpha, (FT*)(0));
if( fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) && if( fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
fit_in_double(get_approx(p).z(), pz) && fit_in_double(get_approx(p).z(), pz) &&
@ -216,6 +217,8 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates {
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Compare_squared_radius_3 with 3 points", tmp); CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Compare_squared_radius_3 with 3 points", tmp);
double px, py, pz, qx, qy, qz, sx, sy, sz, alpha; double px, py, pz, qx, qy, qz, sx, sy, sz, alpha;
init_double(px, py, pz, qx, qy, qz, sx, sy, sz, alpha, (FT*)(0));
if( fit_in_double(p.x(), px) && fit_in_double(p.y(), py) && if( fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(p.z(), pz) && fit_in_double(p.z(), pz) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) && fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
@ -347,6 +350,7 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates {
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Compare_squared_radius_3 with 2 points", tmp); CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Compare_squared_radius_3 with 2 points", tmp);
double px, py, pz, qx, qy, qz, alpha; double px, py, pz, qx, qy, qz, alpha;
init_double(px, py, pz, qx, qy, qz, alpha, (FT*)(0));
if( fit_in_double(p.x(), px) && fit_in_double(p.y(), py) && if( fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(p.z(), pz) && fit_in_double(p.z(), pz) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) && fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&

View File

@ -39,6 +39,103 @@ inline bool diff_was_exact(double a, double b, double ab)
return ab+b == a && a-ab == b; return ab+b == a && a-ab == b;
} }
template < typename T >
inline void init_double(double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&,double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
template < typename T >
inline void init_double(double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, double&, T* ) {}
template < typename ET >
inline void init_double(double& d0, Lazy_exact_nt<ET>* )
{d0 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, Lazy_exact_nt<ET>* )
{d0 = d1 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double& d8, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = 0;}
template < typename ET >
inline void init_double(double& d0, double& d1, double& d2, double& d3, double& d4, double& d5, double& d6, double& d7, double&d8, double& d9, double& d10, double& d11, double& d12, Lazy_exact_nt<ET>* )
{d0 = d1 = d2 = d3 = d4 = d5 = d6 = d7 = d8 = d9 = d10 = d11 = d12 = 0;}
// Auxiliary function to check if static filters can be applied, that is, // Auxiliary function to check if static filters can be applied, that is,
// if to_double() does not add roundoff errors. // if to_double() does not add roundoff errors.
// TODO : // TODO :

View File

@ -31,7 +31,7 @@ int main(int , char**)
for(int i = 0; i < 2; ++i) for(int i = 0; i < 2; ++i)
{ {
Tr::Cell_handle cell; Tr::Cell_handle cell;
int i1, i2, i3; int i1=0, i2=0, i3=0; // initialize to avoid a g++ -Wall warning
tr.is_facet(v[i+1], v[(i+2)&3], v[(i+3)&3], tr.is_facet(v[i+1], v[(i+2)&3], v[(i+3)&3],
cell, cell,
i1, i2, i3); i1, i2, i3);