Repository navigation
cmake: NDEBUG on the mesher's own sources, not all of src/cvc - #882
Merged
Merged
Conversation
The mesher block's add_compile_definitions put libcontour's NDEBUG (its contour.pro sets it in every configuration) on the whole src/cvc directory: the library and every test, in Debug builds too, since the mesher is on by default. assert() was dead in all of them, and tests that sized themselves by NDEBUG took their Release sizes in Debug. NDEBUG now goes on the vendored mesher sources only, as a source property. _BOOL, SP2 and USEDICT stay on the directory: Contour3d's layout depends on USEDICT, and utility/algorithm.cpp includes it through Mesher/mesher.h. The contour-spectrum wrapper is libcvc's own code and keeps its asserts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mesher block in
src/cvc/CMakeLists.txtcalledadd_compile_definitions(... NDEBUG), which puts libcontour'sNDEBUGon the wholesrc/cvcdirectory: the library and every test undersrc/cvc/tests, in every build type. The mesher is on by default, so Debug builds of libcvc have run withassert()compiled out, and tests that size themselves byNDEBUGtook their Release sizes in Debug. LK-18 on the locks branches ran 3000 operations at 12 a second in the Debug package lanes and timed out.state_exec_async_calls_test.cpphad already worked around it.Change
NDEBUGgoes on the vendored mesher sources only (MESHER_SOURCE_FILES, a source property). libcontour set it in every configuration (itscontour.pro), and its Debug-only code (dict.c) and asserts have never been compiled, so the mesher builds exactly as before._BOOL,SP2andUSEDICTstay on the directory.Contour3d's layout depends onUSEDICT, andutility/algorithm.cppincludes it (throughMesher/mesher.h,LBIE_Mesher.h,octree.h), so every file that sees it must agree.contour_spectrum_libcontour.cppis libcvc's own wrapper, so it keeps its asserts.state_exec_async_calls_test.cppnow describes the old behaviour in the past tense.Octree::smoothing_joeliu_volume(JOE_LIU and MINIMAL_VOL) read a tet's fourth vertex astriangles[4*minAspIndx+1][3], one past the 3-element row; the function's other three reads use[2].recipe / ubuntu-latest / DebugfailedGeometryTest.TetrahedralizeWithImprovementMethodson boost::array's(i < N)assert. The mesher's own files still getNDEBUG. But a GCC Debug build doesn't inlineoperator[], so the linker keeps one copy for the whole program, and the one it kept was compiled withoutNDEBUG. In the vector's storage the read landed on the next row's[0], so smoothing silently picked the wrong vertex. It now reads[2].What changes at run time
Only builds without
-DNDEBUGin their flags change, which means Debug builds. Release flags carryNDEBUGthemselves. In Debug,src/cvc's asserts are live again, along with its vendored SDF code's and stb's, andframe_pool.cpp's debug check. The Debug lanes (recipe / * / Debug,package-linux / libcvc-debug*) are where a dormant assert would fire.Testing
Windows, MSVC 19.44, built against the cvcpkg deps prefix. A Windows Debug build would need debug-runtime deps, so this used a Release build with
NDEBUGtaken out of its flags (CMAKE_{C,CXX}_FLAGS_RELEASE=/O2 /Ob2). That leavesassert()live, as in a Debug build. Tests and pycvc were on, cvcGL was off.NDEBUGoncontour/squeue.cppandcontour/dict.c, and absent oncontour_spectrum_libcontour.cpp,utility/algorithm.cppandtests/state_exec_locks_test.cpp.USEDICTis on all five.NDEBUG: geometry_test 111/111, algorithm_test 10/10, lbie_mesher_test 58/58 and fastcontouring_math_test 32/32 pass in full, with no assert. With[3]put back, TetrahedralizeWithImprovementMethods hits the same assert as CI.The Linux and macOS Debug lanes are the first runs with these asserts live under GCC and Clang.