-
Notifications
You must be signed in to change notification settings - Fork 310
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
loader: Introduce error code for initialization #617
Conversation
Codecov Report
@@ Coverage Diff @@
## master #617 +/- ##
=======================================
Coverage 95.73% 95.73%
=======================================
Files 24 24
Lines 3986 3986
=======================================
Hits 3816 3816
Misses 170 170 |
Introduce special loader error code EVMC_LOADER_UNSPECIFIED_ERROR for initializing evmc_loader_error_code objects. This allows defensive usage pattern where user init error code to a value other than EVMC_LOADER_SUCCESS what protects against a misbehaving loader implementation.
@@ -21,7 +21,10 @@ extern "C" { | |||
/** The function pointer type for EVMC create functions. */ | |||
typedef struct evmc_vm* (*evmc_create_fn)(void); | |||
|
|||
/** Error codes for the EVMC loader. */ | |||
/// Error codes for the EVMC loader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
///
for comments are not used anywhere else in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed, but I wanted to use //
everywhere since we enabled C99.
So as I understand this allows to distinguish "loader did nothing" from "loader returned success". |
Yes. This seems better than |
Introduce special loader error code EVMC_LOADER_UNSPECIFIED_ERROR
for initializing evmc_loader_error_code objects. This allows defensive
usage pattern where user init error code to a value other than
EVMC_LOADER_SUCCESS what protects against a misbehaving loader
implementation.
Go and Java bindings use new value. Rust bindings do not have EVMC loader support.