<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 29, 2016, at 11:31 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Nov 28, 2016 at 3:07 PM Mehdi Amini via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mehdi_amini<br class="gmail_msg">
Date: Mon Nov 28 16:57:11 2016<br class="gmail_msg">
New Revision: 288087<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=288087&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=288087&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
Put ABI breaking test in Error checking behind LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
<br class="gmail_msg">
This macro is supposed to be the one controlling the compatibility<br class="gmail_msg">
of ABI breaks induced when enabling or disabling assertions in LLVM.<br class="gmail_msg">
<br class="gmail_msg">
The macro is enabled by default in assertions build, so this commit<br class="gmail_msg">
won't disable the tests.<br class="gmail_msg"></blockquote><div class=""><br class=""></div><div class="">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.<br class=""><br class="">So I get the test cases, but not the ABI_BREAKING_CHECKS defined.<br class=""><br class="">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).</div></div></div></div></blockquote><div><br class=""></div><div>Which test is broken for you?</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
Differential Revision: <a href="https://reviews.llvm.org/D26700" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D26700</a><br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
    llvm/trunk/include/llvm/Support/Error.h<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/include/llvm/Support/Error.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=288087&r1=288086&r2=288087&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=288087&r1=288086&r2=288087&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/include/llvm/Support/Error.h (original)<br class="gmail_msg">
+++ llvm/trunk/include/llvm/Support/Error.h Mon Nov 28 16:57:11 2016<br class="gmail_msg">
@@ -224,7 +224,7 @@ public:<br class="gmail_msg">
<br class="gmail_msg">
 private:<br class="gmail_msg">
   void assertIsChecked() {<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     if (!getChecked() || getPtr()) {<br class="gmail_msg">
       dbgs() << "Program aborted due to an unhandled Error:\n";<br class="gmail_msg">
       if (getPtr())<br class="gmail_msg">
@@ -245,7 +245,7 @@ private:<br class="gmail_msg">
   }<br class="gmail_msg">
<br class="gmail_msg">
   void setPtr(ErrorInfoBase *EI) {<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     Payload = reinterpret_cast<ErrorInfoBase*>(<br class="gmail_msg">
                 (reinterpret_cast<uintptr_t>(EI) &<br class="gmail_msg">
                  ~static_cast<uintptr_t>(0x1)) |<br class="gmail_msg">
@@ -256,7 +256,7 @@ private:<br class="gmail_msg">
   }<br class="gmail_msg">
<br class="gmail_msg">
   bool getChecked() const {<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     return (reinterpret_cast<uintptr_t>(Payload) & 0x1) == 0;<br class="gmail_msg">
 #else<br class="gmail_msg">
     return true;<br class="gmail_msg">
@@ -637,17 +637,11 @@ private:<br class="gmail_msg">
 public:<br class="gmail_msg">
   /// Create an Expected<T> error value from the given Error.<br class="gmail_msg">
   Expected(Error Err)<br class="gmail_msg">
-      : HasError(true),<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+      : HasError(true)<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
         // Expected is unchecked upon construction in Debug builds.<br class="gmail_msg">
-        Unchecked(true)<br class="gmail_msg">
-#else<br class="gmail_msg">
-        // Expected's unchecked flag is set to false in Release builds. This<br class="gmail_msg">
-        // allows Expected values constructed in a Release build library to be<br class="gmail_msg">
-        // consumed by a Debug build application.<br class="gmail_msg">
-        Unchecked(false)<br class="gmail_msg">
+        , Unchecked(true)<br class="gmail_msg">
 #endif<br class="gmail_msg">
-<br class="gmail_msg">
   {<br class="gmail_msg">
     assert(Err && "Cannot create Expected<T> from Error success value.");<br class="gmail_msg">
     new (getErrorStorage()) error_type(Err.takePayload());<br class="gmail_msg">
@@ -664,15 +658,10 @@ public:<br class="gmail_msg">
   Expected(OtherT &&Val,<br class="gmail_msg">
            typename std::enable_if<std::is_convertible<OtherT, T>::value>::type<br class="gmail_msg">
                * = nullptr)<br class="gmail_msg">
-      : HasError(false),<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+      : HasError(false)<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
         // Expected is unchecked upon construction in Debug builds.<br class="gmail_msg">
-        Unchecked(true)<br class="gmail_msg">
-#else<br class="gmail_msg">
-        // Expected's 'unchecked' flag is set to false in Release builds. This<br class="gmail_msg">
-        // allows Expected values constructed in a Release build library to be<br class="gmail_msg">
-        // consumed by a Debug build application.<br class="gmail_msg">
-        Unchecked(false)<br class="gmail_msg">
+        , Unchecked(true)<br class="gmail_msg">
 #endif<br class="gmail_msg">
   {<br class="gmail_msg">
     new (getStorage()) storage_type(std::forward<OtherT>(Val));<br class="gmail_msg">
@@ -717,7 +706,7 @@ public:<br class="gmail_msg">
<br class="gmail_msg">
   /// \brief Return false if there is an error.<br class="gmail_msg">
   explicit operator bool() {<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     Unchecked = HasError;<br class="gmail_msg">
 #endif<br class="gmail_msg">
     return !HasError;<br class="gmail_msg">
@@ -745,7 +734,7 @@ public:<br class="gmail_msg">
   /// only be safely destructed. No further calls (beside the destructor) should<br class="gmail_msg">
   /// be made on the Expected<T> vaule.<br class="gmail_msg">
   Error takeError() {<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     Unchecked = false;<br class="gmail_msg">
 #endif<br class="gmail_msg">
     return HasError ? Error(std::move(*getErrorStorage())) : Error::success();<br class="gmail_msg">
@@ -788,8 +777,10 @@ private:<br class="gmail_msg">
<br class="gmail_msg">
   template <class OtherT> void moveConstruct(Expected<OtherT> &&Other) {<br class="gmail_msg">
     HasError = Other.HasError;<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     Unchecked = true;<br class="gmail_msg">
     Other.Unchecked = false;<br class="gmail_msg">
+#endif<br class="gmail_msg">
<br class="gmail_msg">
     if (!HasError)<br class="gmail_msg">
       new (getStorage()) storage_type(std::move(*Other.getStorage()));<br class="gmail_msg">
@@ -831,7 +822,7 @@ private:<br class="gmail_msg">
   }<br class="gmail_msg">
<br class="gmail_msg">
   void assertIsChecked() {<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
     if (Unchecked) {<br class="gmail_msg">
       dbgs() << "Expected<T> must be checked before access or destruction.\n";<br class="gmail_msg">
       if (HasError) {<br class="gmail_msg">
@@ -851,7 +842,9 @@ private:<br class="gmail_msg">
     AlignedCharArrayUnion<error_type> ErrorStorage;<br class="gmail_msg">
   };<br class="gmail_msg">
   bool HasError : 1;<br class="gmail_msg">
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS<br class="gmail_msg">
   bool Unchecked : 1;<br class="gmail_msg">
+#endif<br class="gmail_msg">
 };<br class="gmail_msg">
<br class="gmail_msg">
 /// This class wraps a std::error_code in a Error.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div>
</div></blockquote></div><br class=""></body></html>