Title: [252731] trunk/Source/WTF
Revision
252731
Author
[email protected]
Date
2019-11-21 04:59:11 -0800 (Thu, 21 Nov 2019)

Log Message

add ASSERT_NOT_REACHED_WITH_MESSAGE and RELEASE_ASSERT_NOT_REACHED_WITH_MESSAGE
https://bugs.webkit.org/show_bug.cgi?id=204445

Patch by Tuomas Karkkainen <[email protected]> on 2019-11-21
Reviewed by Antti Koivisto.

Add assertions that combine ASSERT_NOT_REACHED and ASSERT_WITH_MESSAGE.

* wtf/Assertions.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (252730 => 252731)


--- trunk/Source/WTF/ChangeLog	2019-11-21 12:14:59 UTC (rev 252730)
+++ trunk/Source/WTF/ChangeLog	2019-11-21 12:59:11 UTC (rev 252731)
@@ -1,3 +1,14 @@
+2019-11-21  Tuomas Karkkainen  <[email protected]>
+
+        add ASSERT_NOT_REACHED_WITH_MESSAGE and RELEASE_ASSERT_NOT_REACHED_WITH_MESSAGE
+        https://bugs.webkit.org/show_bug.cgi?id=204445
+
+        Reviewed by Antti Koivisto.
+
+        Add assertions that combine ASSERT_NOT_REACHED and ASSERT_WITH_MESSAGE.
+
+        * wtf/Assertions.h:
+
 2019-11-20  Ross Kirsling  <[email protected]>
 
         Unreviewed, address Darin's feedback on r252683.

Modified: trunk/Source/WTF/wtf/Assertions.h (252730 => 252731)


--- trunk/Source/WTF/wtf/Assertions.h	2019-11-21 12:14:59 UTC (rev 252730)
+++ trunk/Source/WTF/wtf/Assertions.h	2019-11-21 12:59:11 UTC (rev 252731)
@@ -400,6 +400,11 @@
 } while (0)
 #endif
 
+#ifdef __cplusplus
+constexpr bool assertionFailureDueToUnreachableCode = false;
+#define ASSERT_NOT_REACHED_WITH_MESSAGE(...) ASSERT_WITH_MESSAGE(assertionFailureDueToUnreachableCode, __VA_ARGS__)
+#endif
+
 /* ASSERT_WITH_MESSAGE_UNUSED */
 
 #if ASSERT_MSG_DISABLED
@@ -548,6 +553,7 @@
 #endif
 
 #ifdef __cplusplus
+#define RELEASE_ASSERT_NOT_REACHED_WITH_MESSAGE(...) RELEASE_ASSERT_WITH_MESSAGE(assertionFailureDueToUnreachableCode, __VA_ARGS__)
 
 // The combination of line, file, function, and counter should be a unique number per call to this crash. This tricks the compiler into not coalescing calls to WTFCrashWithInfo.
 // The easiest way to fill these values per translation unit is to pass __LINE__, __FILE__, WTF_PRETTY_FUNCTION, and __COUNTER__.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to