Abort on R type error if debugging #860
Merged
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.
Following discussion in #857 , this PR prints an error to standard error, and aborts, allowing a debugger to examine state leading up to the error, instead of dropping out of R. The
assertmacro didn't seem like the right tool, as it would never give an informative error message. The glibcassertmacro callsabort, so I used it here, while checking for absence ofNDEBUG. The default build process in R is done with-DNDEBUGso this should not alter behavior for anyone who hasn't explicitly used-UNDEBUG, and therefore this should not impact any packages built for CRAN in the usual way.There is no obvious way for me to add an automated test for this code, since it requires compiling with and without the
NDEBUGflag set.