From fa5f3d188d6db764ee4e90ef47200fce48233cfd Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Tue, 29 Nov 2016 20:45:48 +0000 Subject: [PATCH] Change Error unittest to use the LLVM_ENABLE_ABI_BREAKING_CHECKS instead of NDEBUG This is consistent with the header (after r288087) and fixes the test for the configuration: -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288196 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Support/ErrorTest.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/unittests/Support/ErrorTest.cpp b/unittests/Support/ErrorTest.cpp index 1fe901745ca..f03e8c38724 100644 --- a/unittests/Support/ErrorTest.cpp +++ b/unittests/Support/ErrorTest.cpp @@ -102,7 +102,7 @@ TEST(Error, CheckedSuccess) { } // Test that unchecked succes values cause an abort. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedSuccess) { EXPECT_DEATH({ Error E = Error::success(); }, "Program aborted due to an unhandled Error:") @@ -128,7 +128,7 @@ TEST(Error, ErrorAsOutParameterChecked) { } // Test that ErrorAsOutParameter clears the checked flag on destruction. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, ErrorAsOutParameterUnchecked) { EXPECT_DEATH({ Error E = Error::success(); errAsOutParamHelper(E); }, "Program aborted due to an unhandled Error:") @@ -139,7 +139,7 @@ TEST(Error, ErrorAsOutParameterUnchecked) { // Check that we abort on unhandled failure cases. (Force conversion to bool // to make sure that we don't accidentally treat checked errors as handled). // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedError) { auto DropUnhandledError = []() { Error E = make_error(42); @@ -377,7 +377,7 @@ TEST(Error, ConsumeError) { // Test that handleAllUnhandledErrors crashes if an error is not caught. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, FailureToHandle) { auto FailToHandle = []() { handleAllErrors(make_error(7), [&](const CustomSubError &SE) { @@ -395,7 +395,7 @@ TEST(Error, FailureToHandle) { // Test that handleAllUnhandledErrors crashes if an error is returned from a // handler. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, FailureFromHandler) { auto ReturnErrorFromHandler = []() { handleAllErrors(make_error(7), @@ -490,7 +490,7 @@ TEST(Error, ExpectedWithReferenceType) { // Test Unchecked Expected in success mode. // We expect this to blow up the same way Error would. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedExpectedInSuccessModeDestruction) { EXPECT_DEATH({ Expected A = 7; }, "Expected must be checked before access or destruction.") @@ -501,7 +501,7 @@ TEST(Error, UncheckedExpectedInSuccessModeDestruction) { // Test Unchecked Expected in success mode. // We expect this to blow up the same way Error would. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedExpectedInSuccessModeAccess) { EXPECT_DEATH({ Expected A = 7; *A; }, "Expected must be checked before access or destruction.") @@ -512,7 +512,7 @@ TEST(Error, UncheckedExpectedInSuccessModeAccess) { // Test Unchecked Expected in success mode. // We expect this to blow up the same way Error would. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UncheckedExpectedInSuccessModeAssignment) { EXPECT_DEATH({ Expected A = 7; A = 7; }, "Expected must be checked before access or destruction.") @@ -532,7 +532,7 @@ TEST(Error, ExpectedInFailureMode) { // Check that an Expected instance with an error value doesn't allow access to // operator*. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, AccessExpectedInFailureMode) { Expected A = make_error(42); EXPECT_DEATH(*A, "Expected must be checked before access or destruction.") @@ -544,7 +544,7 @@ TEST(Error, AccessExpectedInFailureMode) { // Check that an Expected instance with an error triggers an abort if // unhandled. // Test runs in debug mode only. -#ifndef NDEBUG +#ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS TEST(Error, UnhandledExpectedInFailureMode) { EXPECT_DEATH({ Expected A = make_error(42); }, "Expected must be checked before access or destruction.") -- 2.50.1