-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utils: add safety_macros codegen script #2423
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #2423 +/- ##
==========================================
+ Coverage 81.96% 81.99% +0.03%
==========================================
Files 271 272 +1
Lines 18676 18726 +50
==========================================
+ Hits 15307 15354 +47
- Misses 3369 3372 +3 |
f8dd636
to
98168d2
Compare
0322f23
to
15d771b
Compare
11 tasks
baldwinmatt
approved these changes
Dec 1, 2020
lrstewart
reviewed
Dec 1, 2020
15d771b
to
46aaa5e
Compare
SalusaSecondus
approved these changes
Mar 2, 2021
lrstewart
reviewed
Mar 2, 2021
lrstewart
approved these changes
Mar 3, 2021
ttjsu-aws
approved these changes
Mar 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 change continues the
S2N_RESULT
migration. In this phase, we add a codegen script to consistently generate all safety macros.This also changes the macros to explicitly state the context in which it should be used. For example, if a safety macro is used in a function that returns an
int
(i.e. POSIX), safety calls would includePOSIX_GUARD
,POSIX_ENSURE
, etc. If the function returnsS2N_RESULT
, calls should be prefixed withRESULT_
(e.g.RESULT_GUARD
,RESULT_ENSURE
). You can see a list of all of the calls in the auto-generated documentation.Callouts
One thing to note is the
RESULT_
prefix is temporary. After this PR is merged and other existng PRs apply the codemod script, we will have another PR that removes theRESULT_
prefix and makesS2N_RESULT
the preferred error signal return type. Without an intermediate phase, the codemod script will not be idempotent, since all of the prefix-less calls will be ambiguous.Another point is that all of the existing safety macros are unmodified. After applying the codemod script from utils: add safety codemod script #2339, the existing safety macros will be removed in favor of the new naming convention.
Rendered documentation
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.