Bug 1259294: Part 1 - Add MOZ_ALWAYS_SUCCEEDS. r=froydnj
authorKyle Huey <khuey@kylehuey.com>
Mon, 28 Mar 2016 10:28:14 -0700
changeset 290739 932e732dedfed03fcaff46b699ac3c6efb50738d
parent 290738 e979e75c94f650e3a1ecf4b3416a8ab605edb417
child 290740 af8611a7b88ceb68413da8c6c0b3010d82e5fc5c
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1259294
milestone48.0a1
Bug 1259294: Part 1 - Add MOZ_ALWAYS_SUCCEEDS. r=froydnj
xpcom/base/nsError.h
--- a/xpcom/base/nsError.h
+++ b/xpcom/base/nsError.h
@@ -155,16 +155,18 @@ NS_FAILED_impl(nsresult aErr)
 #define NS_SUCCEEDED(_nsresult) ((bool)MOZ_LIKELY(!NS_FAILED_impl(_nsresult)))
 
 /* Check that our enum type is actually uint32_t as expected */
 static_assert(((nsresult)0) < ((nsresult)-1),
               "nsresult must be an unsigned type");
 static_assert(sizeof(nsresult) == sizeof(uint32_t),
               "nsresult must be 32 bits");
 
+#define MOZ_ALWAYS_SUCCEEDS(expr) MOZ_ALWAYS_TRUE(NS_SUCCEEDED(expr))
+
 /**
  * @name Standard Error Generating Macros
  */
 
 #define NS_ERROR_GENERATE(sev, module, code) \
   (nsresult)(((uint32_t)(sev) << 31) | \
              ((uint32_t)(module + NS_ERROR_MODULE_BASE_OFFSET) << 16) | \
              ((uint32_t)(code)))