bug 1252104 - make NS_ERROR_GET_CODE() and NS_ERROR_GET_MODULE() constexpr r=froydnj
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Mon, 29 Feb 2016 10:43:56 -0500
changeset 322485 d37744e8ec76bdb6507e73959cb8b46b03a89b1f
parent 322484 2c4b0bfe69aaab7299a6edc814a04fa1c78a5254
child 322486 fc5cc380ddb34a2939d2a5bc2a6121b879b5fa95
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1252104
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1252104 - make NS_ERROR_GET_CODE() and NS_ERROR_GET_MODULE() constexpr r=froydnj
xpcom/base/nsError.h
--- a/xpcom/base/nsError.h
+++ b/xpcom/base/nsError.h
@@ -6,16 +6,17 @@
 
 #ifndef nsError_h__
 #define nsError_h__
 
 #ifndef __cplusplus
 #error nsError.h no longer supports C sources
 #endif
 
+#include "mozilla/Attributes.h"
 #include "mozilla/Likely.h"
 
 #include <stdint.h>
 
 /*
  * To add error code to your module, you need to do the following:
  *
  * 1) Add a module offset code.  Add yours to the bottom of the list
@@ -185,22 +186,22 @@ static_assert(sizeof(nsresult) == sizeof
 extern nsresult
 NS_ErrorAccordingToNSPR();
 
 
 /**
  * @name Standard Macros for retrieving error bits
  */
 
-inline uint16_t
+inline MOZ_CONSTEXPR uint16_t
 NS_ERROR_GET_CODE(nsresult aErr)
 {
   return uint32_t(aErr) & 0xffff;
 }
-inline uint16_t
+inline MOZ_CONSTEXPR uint16_t
 NS_ERROR_GET_MODULE(nsresult aErr)
 {
   return ((uint32_t(aErr) >> 16) - NS_ERROR_MODULE_BASE_OFFSET) & 0x1fff;
 }
 inline bool
 NS_ERROR_GET_SEVERITY(nsresult aErr)
 {
   return uint32_t(aErr) >> 31;