Files
react-native/ReactCommon/react/debug/react_native_assert.cpp
T
Jeffrey Beauchamp 6e28e2dc99 Back out "Use NSCAssert() in react_native_assert instead of C assert()"
Summary:
Original commit changeset: 43c4e4f1ae6b

Original Phabricator Diff: D43275024 (https://github.com/facebook/react-native/commit/c5bc3f1373d223d4068f762c597bdc45261fb6c5)

D43587488 reverted D43275024 (https://github.com/facebook/react-native/commit/c5bc3f1373d223d4068f762c597bdc45261fb6c5), but it was only committed to the fbobjc/releases/release-fbios-2023.03.01 branch (v404).

We still aren't seeing successful fbios-pika-iphoneos-release builds for v405 (https://fburl.com/mobile/7zac3b5w). This is preventing QA and employee dogfooding of v405 (S325502).

(Note: this ignores all push blocking failures!)

Reviewed By: abashyam

Differential Revision: D43609260

fbshipit-source-id: d411294ad8cdb22ff9e812bf0689d9b7bdff8d2e
2023-02-26 10:24:40 -08:00

46 lines
1.0 KiB
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifdef __ANDROID__
#include <android/log.h>
// Provide a prototype to silence missing prototype warning in release
// mode.
extern "C" void react_native_assert_fail(
const char *func,
const char *file,
int line,
const char *expr);
extern "C" void react_native_assert_fail(
const char *func,
const char *file,
int line,
const char *expr) {
// Print as an error so it shows up in logcat before crash...
__android_log_print(
ANDROID_LOG_ERROR,
"ReactNative",
"%s:%d: function %s: assertion failed (%s)",
file,
line,
func,
expr);
// ...and trigger an abort so it crashes and shows up in uploaded logs.
__android_log_assert(
nullptr,
"ReactNative",
"%s:%d: function %s: assertion failed (%s)",
file,
line,
func,
expr);
}
#endif // __ANDROID__