[llvm] r288087 - Put ABI breaking test in Error checking behind LLVM_ENABLE_ABI_BREAKING_CHECKS
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 12:56:11 PST 2016
Should be fixed with
r288196
> On Nov 29, 2016, at 11:34 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
>
> On Tue, Nov 29, 2016 at 11:33 AM Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote:
>> On Nov 29, 2016, at 11:31 AM, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>>
>>
>> On Mon, Nov 28, 2016 at 3:07 PM Mehdi Amini via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
>> Author: mehdi_amini
>> Date: Mon Nov 28 16:57:11 2016
>> New Revision: 288087
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=288087&view=rev <http://llvm.org/viewvc/llvm-project?rev=288087&view=rev>
>> Log:
>> Put ABI breaking test in Error checking behind LLVM_ENABLE_ABI_BREAKING_CHECKS
>>
>> This macro is supposed to be the one controlling the compatibility
>> of ABI breaks induced when enabling or disabling assertions in LLVM.
>>
>> The macro is enabled by default in assertions build, so this commit
>> won't disable the tests.
>>
>> This doesn't seem to work for my build setup. I'm using the CMake Debug configuration which doesn't define NDEBUG - though I don't have LLVM_ENABLE_ASSERTIONS set.
>>
>> So I get the test cases, but not the ABI_BREAKING_CHECKS defined.
>>
>> It would seem best to set the tests off the same feature that enables/disables the ABI_BREAKING_CHECKS (well, I guess it needs to be both breaking checks and NDEBUG as it is already - if either's disabled, the tests won't work).
>
> Which test is broken for you?
>
> All the death tests that verify that Error fails in the relevant ways.
>
> [ FAILED ] 9 tests, listed below:
> [ FAILED ] Error.ErrorAsOutParameterUnchecked
> [ FAILED ] Error.UncheckedError
> [ FAILED ] Error.FailureToHandle
> [ FAILED ] Error.FailureFromHandler
> [ FAILED ] Error.UncheckedExpectedInSuccessModeDestruction
> [ FAILED ] Error.UncheckedExpectedInSuccessModeAccess
> [ FAILED ] Error.UncheckedExpectedInSuccessModeAssignment
> [ FAILED ] Error.AccessExpectedInFailureMode
> [ FAILED ] Error.UnhandledExpectedInFailureMode
>
>
> —
> Mehdi
>
>
>>
>>
>> Differential Revision: https://reviews.llvm.org/D26700 <https://reviews.llvm.org/D26700>
>>
>> Modified:
>> llvm/trunk/include/llvm/Support/Error.h
>>
>> Modified: llvm/trunk/include/llvm/Support/Error.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=288087&r1=288086&r2=288087&view=diff <http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=288087&r1=288086&r2=288087&view=diff>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/Error.h (original)
>> +++ llvm/trunk/include/llvm/Support/Error.h Mon Nov 28 16:57:11 2016
>> @@ -224,7 +224,7 @@ public:
>>
>> private:
>> void assertIsChecked() {
>> -#ifndef NDEBUG
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> if (!getChecked() || getPtr()) {
>> dbgs() << "Program aborted due to an unhandled Error:\n";
>> if (getPtr())
>> @@ -245,7 +245,7 @@ private:
>> }
>>
>> void setPtr(ErrorInfoBase *EI) {
>> -#ifndef NDEBUG
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> Payload = reinterpret_cast<ErrorInfoBase*>(
>> (reinterpret_cast<uintptr_t>(EI) &
>> ~static_cast<uintptr_t>(0x1)) |
>> @@ -256,7 +256,7 @@ private:
>> }
>>
>> bool getChecked() const {
>> -#ifndef NDEBUG
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> return (reinterpret_cast<uintptr_t>(Payload) & 0x1) == 0;
>> #else
>> return true;
>> @@ -637,17 +637,11 @@ private:
>> public:
>> /// Create an Expected<T> error value from the given Error.
>> Expected(Error Err)
>> - : HasError(true),
>> -#ifndef NDEBUG
>> + : HasError(true)
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> // Expected is unchecked upon construction in Debug builds.
>> - Unchecked(true)
>> -#else
>> - // Expected's unchecked flag is set to false in Release builds. This
>> - // allows Expected values constructed in a Release build library to be
>> - // consumed by a Debug build application.
>> - Unchecked(false)
>> + , Unchecked(true)
>> #endif
>> -
>> {
>> assert(Err && "Cannot create Expected<T> from Error success value.");
>> new (getErrorStorage()) error_type(Err.takePayload());
>> @@ -664,15 +658,10 @@ public:
>> Expected(OtherT &&Val,
>> typename std::enable_if<std::is_convertible<OtherT, T>::value>::type
>> * = nullptr)
>> - : HasError(false),
>> -#ifndef NDEBUG
>> + : HasError(false)
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> // Expected is unchecked upon construction in Debug builds.
>> - Unchecked(true)
>> -#else
>> - // Expected's 'unchecked' flag is set to false in Release builds. This
>> - // allows Expected values constructed in a Release build library to be
>> - // consumed by a Debug build application.
>> - Unchecked(false)
>> + , Unchecked(true)
>> #endif
>> {
>> new (getStorage()) storage_type(std::forward<OtherT>(Val));
>> @@ -717,7 +706,7 @@ public:
>>
>> /// \brief Return false if there is an error.
>> explicit operator bool() {
>> -#ifndef NDEBUG
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> Unchecked = HasError;
>> #endif
>> return !HasError;
>> @@ -745,7 +734,7 @@ public:
>> /// only be safely destructed. No further calls (beside the destructor) should
>> /// be made on the Expected<T> vaule.
>> Error takeError() {
>> -#ifndef NDEBUG
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> Unchecked = false;
>> #endif
>> return HasError ? Error(std::move(*getErrorStorage())) : Error::success();
>> @@ -788,8 +777,10 @@ private:
>>
>> template <class OtherT> void moveConstruct(Expected<OtherT> &&Other) {
>> HasError = Other.HasError;
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> Unchecked = true;
>> Other.Unchecked = false;
>> +#endif
>>
>> if (!HasError)
>> new (getStorage()) storage_type(std::move(*Other.getStorage()));
>> @@ -831,7 +822,7 @@ private:
>> }
>>
>> void assertIsChecked() {
>> -#ifndef NDEBUG
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> if (Unchecked) {
>> dbgs() << "Expected<T> must be checked before access or destruction.\n";
>> if (HasError) {
>> @@ -851,7 +842,9 @@ private:
>> AlignedCharArrayUnion<error_type> ErrorStorage;
>> };
>> bool HasError : 1;
>> +#if LLVM_ENABLE_ABI_BREAKING_CHECKS
>> bool Unchecked : 1;
>> +#endif
>> };
>>
>> /// This class wraps a std::error_code in a Error.
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161129/90ae1fbf/attachment.html>
More information about the llvm-commits
mailing list