enforce result checking for blob and mem #4389
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.
Description of changes:
s2n-tls has strict standard for checking the results of functions, but we rely on contributors remembering to check all of these values. This PR adds "must use" attributes to emit warnings when these conventions are not followed, and also fixed all of those warning that currently exist in our codebase.
Call-outs:
We should probably be adding
MUST_USE
in more places. Additionally, we should considerWerror
for unit tests, but we need to fix the remainingenum-conversion
warning ins2n_signature_algorithms_test.c
before doing that.Ideally we'd switch everything to S2N_RESULT, but that is a much larger effort. This PR instead aims for incremental progress.
s2n_blob_zero
does not force usage of the return result because it is used in DEFER_CLEANUP's in a few places.Testing:
I manually added the
-Werror
flag to our unit tests and then fixed all failures.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.