Removed Microsoft specific _DEBUG flag from the Unix systems.

Made condional compilation of assert code based on #ifndef NDEBUG
instead of #ifdef _DEBUG to compile on Unix systems.
This commit is contained in:
bubnikv 2019-01-30 15:27:11 +01:00
parent 5a28693ff4
commit eec289961a
2 changed files with 9 additions and 10 deletions

View File

@ -86,9 +86,8 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD_REQUIRED ON)
if(NOT WIN32) if(NOT WIN32)
# Add DEBUG flags for the debug builds in a way the Visual Studio adds these flags. # Add DEBUG flags to debug builds.
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>") add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
add_compile_options("$<$<CONFIG:DEBUG>:-D_DEBUG>")
endif() endif()
# To be able to link libslic3r with the Perl XS module. # To be able to link libslic3r with the Perl XS module.

View File

@ -1793,12 +1793,12 @@ static double rotation_diff_z(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to
Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to)); Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to));
Vec3d axis = angle_axis.axis(); Vec3d axis = angle_axis.axis();
double angle = angle_axis.angle(); double angle = angle_axis.angle();
#ifdef _DEBUG #ifndef NDEBUG
if (std::abs(angle) > 1e-8) { if (std::abs(angle) > 1e-8) {
assert(std::abs(axis.x()) < 1e-8); assert(std::abs(axis.x()) < 1e-8);
assert(std::abs(axis.y()) < 1e-8); assert(std::abs(axis.y()) < 1e-8);
} }
#endif /* _DEBUG */ #endif /* NDEBUG */
return (axis.z() < 0) ? -angle : angle; return (axis.z() < 0) ? -angle : angle;
} }
@ -2786,7 +2786,7 @@ void GLCanvas3D::Selection::_render_sidebar_size_hint(Axis axis, double length)
{ {
} }
#ifdef _DEBUG #ifndef NDEBUG
static bool is_rotation_xy_synchronized(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to) static bool is_rotation_xy_synchronized(const Vec3d &rot_xyz_from, const Vec3d &rot_xyz_to)
{ {
Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to)); Eigen::AngleAxisd angle_axis(rotation_xyz_diff(rot_xyz_from, rot_xyz_to));
@ -2820,7 +2820,7 @@ static void verify_instances_rotation_synchronized(const Model &model, const GLV
} }
} }
} }
#endif /* _DEBUG */ #endif /* NDEBUG */
void GLCanvas3D::Selection::_synchronize_unselected_instances(SyncRotationType sync_rotation_type) void GLCanvas3D::Selection::_synchronize_unselected_instances(SyncRotationType sync_rotation_type)
{ {
@ -2880,9 +2880,9 @@ void GLCanvas3D::Selection::_synchronize_unselected_instances(SyncRotationType s
} }
} }
#ifdef _DEBUG #ifndef NDEBUG
verify_instances_rotation_synchronized(*m_model, *m_volumes); verify_instances_rotation_synchronized(*m_model, *m_volumes);
#endif /* _DEBUG */ #endif /* NDEBUG */
} }
void GLCanvas3D::Selection::_synchronize_unselected_volumes() void GLCanvas3D::Selection::_synchronize_unselected_volumes()
@ -4681,10 +4681,10 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
} }
if (printer_technology == ptSLA) { if (printer_technology == ptSLA) {
const SLAPrint *sla_print = this->sla_print(); const SLAPrint *sla_print = this->sla_print();
#ifdef _DEBUG #ifndef NDEBUG
// Verify that the SLAPrint object is synchronized with m_model. // Verify that the SLAPrint object is synchronized with m_model.
check_model_ids_equal(*m_model, sla_print->model()); check_model_ids_equal(*m_model, sla_print->model());
#endif /* _DEBUG */ #endif /* NDEBUG */
sla_support_state.reserve(sla_print->objects().size()); sla_support_state.reserve(sla_print->objects().size());
for (const SLAPrintObject *print_object : sla_print->objects()) { for (const SLAPrintObject *print_object : sla_print->objects()) {
SLASupportState state; SLASupportState state;