Skip to content
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

Avoid nullability compiler/clang-tidy warnings in _GTMDevAssert. #254

Merged
merged 1 commit into from
Jan 21, 2020

Conversation

mwyman
Copy link
Contributor

@mwyman mwyman commented Jan 21, 2020

The string parameters in NSAssertionHandler's -handleFailureInFunction:… method are declared nonnull, but converting PRETTY_FUNCTION and FILE to NSString (via +[NSString stringWithUTF8String:] returns nullable, leading to warnings.

I don't know of any reason PRETTY_FUNCTION or FILE would ever fail to convert to UTF-8, but this deals with the warnings by explicitly handling the nil return case from stringWithUTF8String: by providing a static string.

Also adds a __builtin_expect() around the condition, as the intention is that the condition should never be true.

The string parameters in NSAssertionHandler's -handleFailureInFunction:… method are declared nonnull, but converting __PRETTY_FUNCTION__ and __FILE__ to NSString (via +[NSString stringWithUTF8String:] returns nullable, leading to warnings.
GTMDefines.h Show resolved Hide resolved
@thomasvl thomasvl merged commit 074577c into google:master Jan 21, 2020
@mwyman mwyman deleted the gtmdevassert-nullability branch January 21, 2020 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants