From bb0ec94290733835df0716531c30460fc5b5210a Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 6 Dec 2011 01:43:44 +0100 Subject: #undef NDEBUG before including any CGAL headers diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 78b9c78..1772354 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -16,9 +16,15 @@ #include "CGALCache.h" #include "cgal.h" #include "cgalutils.h" -#include -#include + +#ifdef NDEBUG +#define PREV_NDEBUG NDEBUG +#undef NDEBUG +#endif #include +#ifdef PREV_NDEBUG +#define NDEBUG PREV_NDEBUG +#endif #include #include diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index 61ca2f8..8c65777 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -5,7 +5,6 @@ #include "polyset.h" #include "dxfdata.h" #include "dxftess.h" -#include CGAL_Nef_polyhedron::CGAL_Nef_polyhedron(CGAL_Nef_polyhedron2 *p) { diff --git a/src/cgal.h b/src/cgal.h index 669e5b1..9810340 100644 --- a/src/cgal.h +++ b/src/cgal.h @@ -16,6 +16,16 @@ using boost::uintmax_t; #error CGAL >= 3.6 is required! #endif +// NDEBUG must be disabled when including CGAL headers, otherwise CGAL assertions +// will not be thrown, causing OpenSCAD's CGAL error checking to fail. +// To be on the safe side, this has to be done when including any CGAL header file. +// FIXME: It might be possible to rewrite the error checking to get rid of this +// requirement. kintel 20111206. +#ifdef NDEBUG +#define PREV_NDEBUG NDEBUG +#undef NDEBUG +#endif + #include #include #include @@ -26,6 +36,11 @@ using boost::uintmax_t; #include #include #include +#include +#include + +#include +#include typedef CGAL::Gmpq NT; typedef CGAL::Extended_cartesian CGAL_Kernel2; @@ -44,6 +59,10 @@ typedef CGAL::Polyhedron_3 CGAL_Polyhedron; typedef CGAL_Polyhedron::HalfedgeDS CGAL_HDS; typedef CGAL::Polyhedron_incremental_builder_3 CGAL_Polybuilder; +#ifdef PREV_NDEBUG +#define NDEBUG PREV_NDEBUG +#endif + #endif /* ENABLE_CGAL */ #endif diff --git a/src/cgaladv_minkowski2.cc b/src/cgaladv_minkowski2.cc index 4ce684f..583217b 100644 --- a/src/cgaladv_minkowski2.cc +++ b/src/cgaladv_minkowski2.cc @@ -30,9 +30,6 @@ #include "grid.h" #include "cgal.h" - -#include - extern CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p); //----------------------------------------------------------------------------- diff --git a/src/cgalutils.cc b/src/cgalutils.cc index 1de7ab4..64782fb 100644 --- a/src/cgalutils.cc +++ b/src/cgalutils.cc @@ -5,8 +5,6 @@ #include "printutils.h" #include "cgal.h" -#include -#include #include diff --git a/src/dxftess-cgal.cc b/src/dxftess-cgal.cc index cf5b75d..5b4e953 100644 --- a/src/dxftess-cgal.cc +++ b/src/dxftess-cgal.cc @@ -3,15 +3,22 @@ #include "dxfdata.h" #include "polyset.h" #include "grid.h" +#include "cgal.h" +#ifdef NDEBUG +#define PREV_NDEBUG NDEBUG +#undef NDEBUG +#endif #include #include #include #include #include #include -#include -#include +#include +#ifdef PREV_NDEBUG +#define NDEBUG PREV_NDEBUG +#endif typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Triangulation_vertex_base_2 Vb; @@ -23,8 +30,6 @@ typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typedef CDT::Vertex_handle Vertex_handle; typedef CDT::Point CDTPoint; -#include - #include template class DummyCriteria { diff --git a/src/openscad.cc b/src/openscad.cc index 67112d8..0d5b25e 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -42,7 +42,6 @@ #ifdef ENABLE_CGAL #include "CGAL_Nef_polyhedron.h" -#include #include "CGALEvaluator.h" #include "PolySetCGALEvaluator.h" #endif diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index fcc5977..800a829 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -54,10 +54,6 @@ #include #include -#ifdef ENABLE_CGAL -#include -#endif - std::string commandline_commands; QString currentdir; QString examplesdir; -- cgit v0.10.1