Disable RCTAssert completely in production builds

Reviewed By: @tadeuzagallo, @jspahrsummers

Differential Revision: D2521700

fb-gh-sync-id: f769afd98bb662e8bbe773adb45990f2175cdfe4
This commit is contained in:
Pieter De Baets
2015-10-08 08:13:16 -07:00
committed by facebook-github-bot-4
parent 63a37be1dd
commit 6ca8f4836d
2 changed files with 6 additions and 2 deletions

View File

@@ -28,8 +28,10 @@ typedef void (^RCTAssertFunction)(
);
/**
* This is the main assert macro that you should use.
* This is the main assert macro that you should use. Asserts should be compiled out
* in production builds
*/
#ifndef NS_BLOCK_ASSERTIONS
#define RCTAssert(condition, ...) do { \
if ((condition) == 0) { \
_RCTAssertFormat(#condition, __FILE__, __LINE__, __func__, __VA_ARGS__); \
@@ -39,6 +41,9 @@ typedef void (^RCTAssertFunction)(
} \
} \
} while (false)
#else
#define RCTAssert(condition, ...) do {} while (false)
#endif
RCT_EXTERN void _RCTAssertFormat(
const char *, const char *, int, const char *, NSString *, ...
) NS_FORMAT_FUNCTION(5,6);

View File

@@ -104,7 +104,6 @@ void _RCTAssertFormat(
{
RCTAssertFunction assertFunction = RCTGetLocalAssertFunction();
if (assertFunction) {
va_list args;
va_start(args, format);
NSString *message = [[NSString alloc] initWithFormat:format arguments:args];