-
Notifications
You must be signed in to change notification settings - Fork 220
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
API's Null pointer check in void methods #765
Comments
You should be able to use
Note the comma because its a two-arg macro, but you don't actually have to use the second arg, but it has to be there syntactically. However in general
By design if a function returns |
Interesting topic... let's go with the BUGCHECK for now. We can trade changing function returns for APIs that can only fail when a bad pointer is passed in at a later date. |
FWIW I think most (if not all?) of the functions that fall into this category are internal/helper functions and therefore should just do what they are told (case 1). If it were a public API then it should probably return something (case 2). At this point its not clear to me if there are any public APIs that are affected - so there may not be any real issue here... |
After going through and removing the checks from internal methods there are still 2 cases. osal/src/os/shared/src/osapi-idmap.c Lines 1428 to 1454 in bfca5b2
osal/src/os/shared/src/osapi-printf.c Lines 245 to 306 in bfca5b2
|
Yeah for those two it should be possible to use the BUGCHECK macro but leave the second argument blank. That way it basically turns into a simple assert (depending on whether strict checking is enabled in the config). |
Integration Candidate: 2020-06-24
Is your feature request related to a problem? Please describe.
Some pointers are used in methods that return void so the OS_CHECK_POINTER function doesn't work in those methods since it returns an error code. There needs to be a way to check that pointers are valid inside void methods.
Describe the solution you'd like
Need to discuss the best solution
Additional context
related to #742, That branch has this comment marking everywhere it comes up.
/* TODO: void pointer, #765 */
Requester Info
Alex Campbell GSFC
The text was updated successfully, but these errors were encountered: