Skip to content

Remove/cleanup LAL_NDEBUG/NDEBUG in libraries other than LAL

Karl Wette requested to merge ANU-CGA/lalsuite:remove-LAL_NDEBUG-2 into master


To help streamline merging the changes in !1930 (merged) I have split off the non-LAL changes from !1930 (merged) into this separate MR.

Summary: This MR and !1930 (merged) are motivated by a recent issue (#573 (closed)) which exposed some bugs in LALSuite when the debugging symbols LAL_NDEBUG/NDEBUG were not defined in a consistent way. The goal is to largely eliminate use of these symbols in LALSuite to avoid this happening in future.

LAL_NDEBUG/NDEBUG are often used to disable error checking/error printing code. Given that LALSuite is typically not compiled with LAL_NDEBUG/NDEBUG this code has already been in production usage, and clearly does not have a significant performance penalty. In any case, any performance improvement would be small compact to the human cost of debugging weird/silent failures because error checks were suppressed. So I have simply removed the #ifndef LAL_NDEBUG/#ifndef NDEBUG checks, so the error checking/error printing code is always compiled.

In a few places (lalpulsar/bin/HoughFstat/LocalComputeFstatHoughMap.c, lalpulsar/lib/SinCosLUT.i) some code removed by LAL_NDEBUG/NDEBUG may have a performance penalty. In these cases I have either used a different local macro to disable to code (to give better control) or used another solution to mitigate any (unlikely) performance degradation.

This MR has no API changes; it only modifies .c or other compiled C files, not C headers.

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

Review Status

cc @adam-mercer

Edited by Karl Wette

Merge request reports