Add Checked Blocks/Pragmas to Olden/em3d, Olden/health, Olden/mst #36
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.
This adds Checked blocks and pragmas to as much code in the following benchmarks as possible:
In almost all cases I've tried to keep the number of changed lines to a reasonable minimum.
Local benchmark headers have had a
#pragma BOUNDS_CHECKED ON
at the top, and importantly,#pragma BOUNDS_CHECKED OFF
at the bottom, so that we don't have to reorder any other headers.With logging, I've tried to keep
chatting
invocations on one line, rather than having thechecked
block start on the previous line.There's a bug on Mac OS X where
NULL
is a macro that expands (via__DARWIN_NULL
) to((void*) 0)
which is annoying, so I added a hack tostdlib_checked.h
to get rid of the error. This seemed a reasonable approach, but I've not seen the equivalent errors on Linux yet.This caught two unintended uses of unchecked pointers in Olden/em3d, which is good. I've fixed them in this PR.
There's still an issue with bounds interop types and
calloc
, but I've not seen the same error with any other functions, which is fantastic (all printf's are inside unchecked blocks as we don't yet support null-terminated strings)