Re-add support for using Yoga without exceptions (#1006)
Summary:
This is a partial rollback of 07c0d539bd
.
Pull Request resolved: https://github.com/facebook/yoga/pull/1006
Reviewed By: yungsters
Differential Revision: D40032544
Pulled By: yungsters
fbshipit-source-id: 9ef9b80672eced86a98cfae66c81710bd3ee6f9b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ec0a829110
commit
e1b401ca36
@@ -580,7 +580,11 @@ TEST(YogaDeathTest, cannot_add_child_to_node_with_measure_func) {
|
||||
root->setMeasureFunc(_measure);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
#if defined(__cpp_exceptions)
|
||||
ASSERT_THROW(YGNodeInsertChild(root, root_child0, 0), std::logic_error);
|
||||
#else // !defined(__cpp_exceptions)
|
||||
ASSERT_DEATH(YGNodeInsertChild(root, root_child0, 0), "Cannot add child.*");
|
||||
#endif // defined(__cpp_exceptions)
|
||||
YGNodeFree(root_child0);
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -589,7 +593,11 @@ TEST(YogaDeathTest, cannot_add_nonnull_measure_func_to_non_leaf_node) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
#if defined(__cpp_exceptions)
|
||||
ASSERT_THROW(root->setMeasureFunc(_measure), std::logic_error);
|
||||
#else // !defined(__cpp_exceptions)
|
||||
ASSERT_DEATH(root->setMeasureFunc(_measure), "Cannot set measure function.*");
|
||||
#endif // defined(__cpp_exceptions)
|
||||
YGNodeFreeRecursive(root);
|
||||
}
|
||||
|
||||
|
@@ -75,5 +75,9 @@ YGFloatOptional YGFloatOptionalMax(YGFloatOptional op1, YGFloatOptional op2) {
|
||||
}
|
||||
|
||||
void throwLogicalErrorWithMessage(const char* message) {
|
||||
#if defined(__cpp_exceptions)
|
||||
throw std::logic_error(message);
|
||||
#else // !defined(__cpp_exceptions)
|
||||
std::terminate();
|
||||
#endif // defined(__cpp_exceptions)
|
||||
}
|
||||
|
Reference in New Issue
Block a user