Originally created by: *anonymous
Originally created by: dak@gnu.org
Originally owned by: dak@gnu.org
At the current point of time, -enable-optimising implies -DNDEBUG which is nonsensical.
-DNDEBUG has the effect of disabling "assert" in the standard library. The normal use of assert is to spell out an underlying assumption that the following code depends on. A failed assertion implies broken program logic, and an inability to provide useful results. Disabling assertions saves a minimal amount of execution time (one should not use expensive function calls in assertions) and is mostly there for mission-critical code where graceful failure is not an option, or for end-user code without a useful interface for relaying the assertion message. Basically, when a program crashing silently or continuing with wrong results is just as bad as a controlled exit.
LilyPond is a console program. It will always report failed assertions to stderr where they can be reported. Compiling it with disabled assertions makes no sense. Even if it is running as a software service hidden to the end user, the application using it can make use of stderr.
It would be conceivable to add an "-disable-checking" option to configure, but if there ever is a valid use case, the requirements will be so special that having to add -DNDEBUG manually to CXXFLAGS is quite acceptable.
Programming errors are things that should not occur with regular use, but may be due to user error and where a strategy for continuing is feasible. It does not make sense to enable checks for programming errors (there is no way of disabling them currently) while disabling assertions.
So my feeling with regard to NDEBUG is: hands off.
Now LilyPond has several more expensive checks and/or gathering of runtime profiles (the latter might warrant a separate configuration option, in particular since their presence might affect normal operations, to the degree where garbage collection problems, to be diagnosed with expensive checks, disappear). If we want to enable/disable them selectively, -DDEBUG is sort of customary for that. A configure option -denable-checks or -denable-debug seems useful for that (Patchy should use that).
All of the debugging options should be _orthogonal_ to -disable-optimising. In fact, the debugging options are _very_ important when optimising is _enabled_ since a number of garbage collection problems are more likely to appear when the optimiser is being used. While it is true that optimisation can complicate debugging, there is no larger obstacle to debugging than not being able to trigger the bug.
Originally posted by: dak@gnu.org
Issue 2787: Sanitize usage of -DDEBUG, -DNDEBUG and assert
The compiler option -DNDEBUG is no longer being used: -DNDEBUG disables
the assert function, and assert is essentially stating that the program
cannot useful continue if the assertion is not met. -DNDEBUG is
basically an option for compiling an application to a limited amount of
ROM when aborting with a diagnostic is not preferable to crashing.
This is not the case for LilyPond. So expensive debugging options now
are enabled with -DDEBUG instead. At the current point of time, setting
this is still tied to the configure option --disable-optimising. It
might make sense to move this to a separate option --enable-testing or
similar, but that would require simultaneous changes to the Patchy
testing framework.
http://codereview.appspot.com/236190043
Labels: Patch-new
Owner: dak@gnu.org
Status: Started
Originally posted by: dak@gnu.org
Add --enable-checking option, let it be implied by --disable-optimising for now
http://codereview.appspot.com/236190043
Originally posted by: dak@gnu.org
Patchy the autobot says: passes tests.
Labels: -Patch-new Patch-review
Originally posted by: pkx1...@gmail.com
Patchy the autobot says: passes tests. Includes a full make doc
Originally posted by: pkx1...@gmail.com
Patch on countdown for May 19th
Labels: -Patch-review Patch-countdown Type-Scripts
Originally posted by: pkx1...@gmail.com
Patch counted down - please push
Labels: -Patch-countdown Patch-push
Originally posted by: pkx1...@gmail.com
Patch counted down - please push
Originally posted by: dak@gnu.org
Pushed to staging as
commit [ra4cc910a3401d25bb94ff0ecb4dc18f681c71004]
Author: David Kastrup <dak@gnu.org>
Date: Tue May 12 19:01:57 2015 +0200
Issue 2787: Sanitize usage of -DDEBUG, -DNDEBUG and assert
The compiler option -DNDEBUG is no longer being used: -DNDEBUG disables
the assert function, and assert is essentially stating that the program
cannot useful continue if the assertion is not met. -DNDEBUG is
basically an option for compiling an application to a limited amount of
ROM when aborting with a diagnostic is not preferable to crashing.
This is not the case for LilyPond. So expensive debugging options now
are enabled with -DDEBUG instead. There is a new configure option
--enable-checking defaulting to "off" for this now.
At the current point of time, setting --disable-optimising also has the
effect of enabling the checks: this will be retained until Patchy has
been adapted to using --enable-checking.
Labels: -Patch-push -Type-Scripts Fixed_2_19_21 Type-Build
Status: Fixed
Originally posted by: PhilEHol...@googlemail.com
(No comment was entered for this change.)
Status: Verified