diff options
-rw-r--r-- | GTMDefines.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/GTMDefines.h b/GTMDefines.h index 68ff8c0..f2c047e 100644 --- a/GTMDefines.h +++ b/GTMDefines.h @@ -130,11 +130,16 @@ #if !defined(NS_BLOCK_ASSERTIONS) #define _GTMDevAssert(condition, ...) \ do { \ - if (!(condition)) { \ + if (__builtin_expect(!(condition), 0)) { \ + NSString *__assert_func_name__ = \ + [NSString stringWithUTF8String:__PRETTY_FUNCTION__]; \ + __assert_func_name__ = __assert_func_name__ ?: @"<Unknown Function>"; \ + NSString *__assert_file_name__ = \ + [NSString stringWithUTF8String:__FILE__]; \ + __assert_file_name__ = __assert_file_name__ ?: @"<Unknown File>"; \ [[NSAssertionHandler currentHandler] \ - handleFailureInFunction:(NSString *) \ - [NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ - file:(NSString *)[NSString stringWithUTF8String:__FILE__] \ + handleFailureInFunction:__assert_func_name__ \ + file:__assert_file_name__ \ lineNumber:__LINE__ \ description:__VA_ARGS__]; \ } \ |