mirror of
https://github.com/status-im/react-native.git
synced 2025-01-25 08:48:58 +00:00
a731a23d91
Summary: The goal of this diff is to have assertion failures show up as error logs on Android. To do this, I updated the logging API to take calls with log levels. We now have to pass around va_list unfortunately since you can't re-expand or pass along var-args to a subcall. Reviewed By: emilsjolander Differential Revision: D4140898 fbshipit-source-id: e0eb9a1f0b08a7d90a8233f66bb857d5b871b6ad
49 lines
1.0 KiB
C
49 lines
1.0 KiB
C
/**
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
#define CSS_EXTERN_C_BEGIN extern "C" {
|
|
#define CSS_EXTERN_C_END }
|
|
#else
|
|
#define CSS_EXTERN_C_BEGIN
|
|
#define CSS_EXTERN_C_END
|
|
#endif
|
|
|
|
#ifdef _WINDLL
|
|
#define WIN_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define WIN_EXPORT
|
|
#endif
|
|
|
|
#ifndef FB_ASSERTIONS_ENABLED
|
|
#define FB_ASSERTIONS_ENABLED 1
|
|
#endif
|
|
|
|
#if FB_ASSERTIONS_ENABLED
|
|
#define CSS_ABORT() abort()
|
|
#else
|
|
#define CSS_ABORT()
|
|
#endif
|
|
|
|
#if CSS_ASSERT_FAIL_ENABLED
|
|
#define CSS_ERROR_FUNC(message) CSSAssertFail(message)
|
|
#else
|
|
#define CSS_ERROR_FUNC(message) CSSLog(CSSLogLevelError, "%s", message)
|
|
#endif
|
|
|
|
#ifndef CSS_ASSERT
|
|
#define CSS_ASSERT(X, message) \
|
|
if (!(X)) { \
|
|
CSS_ERROR_FUNC(message); \
|
|
CSS_ABORT(); \
|
|
}
|
|
#endif
|