Bug 895582 - Get rid of MOZ_ENUM_TYPE. r=waldo
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 21 Jan 2015 22:35:19 +0900
changeset 253689 e22b313075cc688e8e561b171b636fa7793ce6e2
parent 253688 bd7d13e5875c5003667658b50668a8eda4688621
child 253690 e6d21c2fa111a6cf906cdc27bf0a38d5c78f285f
push id721
push userjlund@mozilla.com
push dateTue, 21 Apr 2015 23:03:33 +0000
treeherdermozilla-release@d27c9211ebb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs895582
milestone38.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 895582 - Get rid of MOZ_ENUM_TYPE. r=waldo
accessible/base/RelationType.h
dom/base/nsContentUtils.h
dom/camera/CameraPreferences.cpp
dom/camera/CameraPreferences.h
dom/events/EventListenerManager.h
dom/events/EventStateManager.h
dom/media/webaudio/AudioEventTimeline.h
dom/svg/SVGPreserveAspectRatio.h
js/src/jsinfer.h
js/src/vm/StructuredClone.cpp
mfbt/TypedEnum.h
mfbt/TypedEnumInternal.h
uriloader/prefetch/nsOfflineCacheUpdate.h
widget/EventForwards.h
widget/nsIWidget.h
widget/windows/nsTextStore.h
xpcom/base/nsError.h
--- a/accessible/base/RelationType.h
+++ b/accessible/base/RelationType.h
@@ -7,17 +7,17 @@
 #ifndef mozilla_a11y_relationtype_h_
 #define mozilla_a11y_relationtype_h_
 
 #include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 namespace a11y {
 
-MOZ_BEGIN_ENUM_CLASS(RelationType)
+enum class RelationType {
 
   /**
    * This object is labelled by a target object.
    */
   LABELLED_BY = 0x00,
 
   /**
    * This object is label for a target object.
@@ -126,14 +126,14 @@ MOZ_BEGIN_ENUM_CLASS(RelationType)
 
   /**
    * The target object is the containing application object.
    */
   CONTAINING_APPLICATION = 0x14,
 
   LAST = CONTAINING_APPLICATION
 
-MOZ_END_ENUM_CLASS(RelationType)
+};
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1276,17 +1276,17 @@ public:
 
   /**
    * Utility method that checks if a given node has any non-empty children. This
    * method does not descend recursively into children by default.
    *
    * @param aDiscoverMode Set to eRecurseIntoChildren to descend recursively
    * into children.
    */
-  enum TextContentDiscoverMode MOZ_ENUM_TYPE(uint8_t) {
+  enum TextContentDiscoverMode : uint8_t {
     eRecurseIntoChildren, eDontRecurseIntoChildren
   };
 
   static bool HasNonEmptyTextContent(
     nsINode* aNode,
     TextContentDiscoverMode aDiscoverMode = eDontRecurseIntoChildren);
 
   /**
@@ -2070,17 +2070,17 @@ public:
    * NOTE: the caller has to make sure autocomplete makes sense for the
    * element's type.
    *
    * @param aInput the input element to check. NOTE: aInput can't be null.
    * @return whether the input element has autocomplete enabled.
    */
   static bool IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput);
 
-  enum AutocompleteAttrState MOZ_ENUM_TYPE(uint8_t)
+  enum AutocompleteAttrState : uint8_t
   {
     eAutocompleteAttrState_Unknown = 1,
     eAutocompleteAttrState_Invalid,
     eAutocompleteAttrState_Valid,
   };
   /**
    * Parses the value of the autocomplete attribute into aResult, ensuring it's
    * composed of valid tokens, otherwise the value "" is used.
--- a/dom/camera/CameraPreferences.cpp
+++ b/dom/camera/CameraPreferences.cpp
@@ -32,29 +32,27 @@ uint32_t CameraPreferences::sPrefCameraC
 bool CameraPreferences::sPrefCameraParametersIsLowMemory = false;
 
 #ifdef MOZ_WIDGET_GONK
 StaticRefPtr<CameraPreferences> CameraPreferences::sObserver;
 
 NS_IMPL_ISUPPORTS(CameraPreferences, nsIObserver);
 #endif
 
-#ifdef CAMERAPREFERENCES_HAVE_SEPARATE_UINT32_AND_NSRESULT
 /* static */
 nsresult
 CameraPreferences::UpdatePref(const char* aPref, nsresult& aVal)
 {
   uint32_t val;
   nsresult rv = Preferences::GetUint(aPref, &val);
   if (NS_SUCCEEDED(rv)) {
     aVal = static_cast<nsresult>(val);
   }
   return rv;
 }
-#endif
 
 /* static */
 nsresult
 CameraPreferences::UpdatePref(const char* aPref, uint32_t& aVal)
 {
   uint32_t val;
   nsresult rv = Preferences::GetUint(aPref, &val);
   if (NS_SUCCEEDED(rv)) {
@@ -151,26 +149,24 @@ CameraPreferences::PreferenceChanged(con
     DOM_CAMERA_LOGE("Preference '%s' is not tracked by CameraPreferences\n", aPref);
     return;
   }
 
   Pref& p = sPrefs[i];
   nsresult rv;
   switch (p.mValueType) {
     case kPrefValueIsNsResult:
-    #ifdef CAMERAPREFERENCES_HAVE_SEPARATE_UINT32_AND_NSRESULT
       {
         nsresult& v = *p.mValue.mAsNsResult;
         rv = UpdatePref(aPref, v);
         if (NS_SUCCEEDED(rv)) {
           DOM_CAMERA_LOGI("Preference '%s' has changed, 0x%x\n", aPref, v);
         }
       }
       break;
-    #endif
 
     case kPrefValueIsUint32:
       {
         uint32_t& v = *p.mValue.mAsUint32;
         rv = UpdatePref(aPref, v);
         if (NS_SUCCEEDED(rv)) {
           DOM_CAMERA_LOGI("Preference '%s' has changed, %u\n", aPref, v);
         }
@@ -326,17 +322,16 @@ CameraPreferences::GetPref(const char* a
     return false;
   }
 
   DOM_CAMERA_LOGI("Preference '%s', got '%s'\n", aPref, (*s)->get());
   aVal = **s;
   return true;
 }
 
-#ifdef CAMERAPREFERENCES_HAVE_SEPARATE_UINT32_AND_NSRESULT
 /* static */
 bool
 CameraPreferences::GetPref(const char* aPref, nsresult& aVal)
 {
   MOZ_ASSERT(sPrefMonitor, "sPrefMonitor missing in CameraPreferences::GetPref()");
   MonitorAutoLock mon(*sPrefMonitor);
 
   uint32_t i = PrefToIndex(aPref);
@@ -354,17 +349,16 @@ CameraPreferences::GetPref(const char* a
     DOM_CAMERA_LOGW("Preference '%s' is not set\n", aPref);
     return false;
   }
 
   DOM_CAMERA_LOGI("Preference '%s', got 0x%x\n", aPref, v);
   aVal = v;
   return true;
 }
-#endif
 
 /* static */
 bool
 CameraPreferences::GetPref(const char* aPref, uint32_t& aVal)
 {
   MOZ_ASSERT(sPrefMonitor, "sPrefMonitor missing in CameraPreferences::GetPref()");
   MonitorAutoLock mon(*sPrefMonitor);
 
--- a/dom/camera/CameraPreferences.h
+++ b/dom/camera/CameraPreferences.h
@@ -7,23 +7,16 @@
 #define DOM_CAMERA_CAMERAPREFERENCES_H
 
 #include "nsString.h"
 #include "nsIObserver.h"
 #ifdef MOZ_WIDGET_GONK
 #include "mozilla/StaticPtr.h"
 #endif
 
-#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) || defined(MOZ_HAVE_CXX11_ENUM_TYPE)
-// Older compilers that don't support strongly-typed enums
-// just typedef uint32_t to nsresult, which results in conflicting
-// overloaded members in CameraPreferences.
-#define CAMERAPREFERENCES_HAVE_SEPARATE_UINT32_AND_NSRESULT
-#endif
-
 namespace mozilla {
 
 template<class T> class StaticAutoPtr;
 
 class CameraPreferences
 #ifdef MOZ_WIDGET_GONK
   : public nsIObserver
 #endif
@@ -33,30 +26,26 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 #endif
 
   static bool Initialize();
   static void Shutdown();
 
   static bool GetPref(const char* aPref, nsACString& aVal);
-#ifdef CAMERAPREFERENCES_HAVE_SEPARATE_UINT32_AND_NSRESULT
   static bool GetPref(const char* aPref, nsresult& aVal);
-#endif
   static bool GetPref(const char* aPref, uint32_t& aVal);
   static bool GetPref(const char* aPref, bool& aVal);
 
 protected:
   static const uint32_t kPrefNotFound = UINT32_MAX;
   static uint32_t PrefToIndex(const char* aPref);
 
   static void PreferenceChanged(const char* aPref, void* aClosure);
-#ifdef CAMERAPREFERENCES_HAVE_SEPARATE_UINT32_AND_NSRESULT
   static nsresult UpdatePref(const char* aPref, nsresult& aVar);
-#endif
   static nsresult UpdatePref(const char* aPref, uint32_t& aVar);
   static nsresult UpdatePref(const char* aPref, nsACString& aVar);
   static nsresult UpdatePref(const char* aPref, bool& aVar);
 
   enum PrefValueType {
     kPrefValueIsNsResult,
     kPrefValueIsUint32,
     kPrefValueIsCString,
--- a/dom/events/EventListenerManager.h
+++ b/dom/events/EventListenerManager.h
@@ -157,17 +157,17 @@ class EventListenerManager MOZ_FINAL
 public:
   struct Listener
   {
     EventListenerHolder mListener;
     nsCOMPtr<nsIAtom> mTypeAtom; // for the main thread
     nsString mTypeString; // for non-main-threads
     uint16_t mEventType;
 
-    enum ListenerType MOZ_ENUM_TYPE(uint8_t)
+    enum ListenerType : uint8_t
     {
       eNativeListener = 0,
       eJSEventListener,
       eWrappedJSListener,
       eWebIDLListener,
       eListenerTypeCount
     };
     uint8_t mListenerType;
--- a/dom/events/EventStateManager.h
+++ b/dom/events/EventStateManager.h
@@ -424,17 +424,17 @@ protected:
      * prefs, the overflowDelta values would be inflated.
      * CancelApplyingUserPrefsFromOverflowDelta() cancels the inflation.
      */
     void CancelApplyingUserPrefsFromOverflowDelta(WidgetWheelEvent* aEvent);
 
     /**
      * Computes the default action for the aEvent with the prefs.
      */
-    enum Action MOZ_ENUM_TYPE(uint8_t)
+    enum Action : uint8_t
     {
       ACTION_NONE = 0,
       ACTION_SCROLL,
       ACTION_HISTORY,
       ACTION_ZOOM,
       ACTION_LAST = ACTION_ZOOM
     };
     Action ComputeActionFor(WidgetWheelEvent* aEvent);
--- a/dom/media/webaudio/AudioEventTimeline.h
+++ b/dom/media/webaudio/AudioEventTimeline.h
@@ -18,17 +18,17 @@
 #include "WebAudioUtils.h"
 
 namespace mozilla {
 
 namespace dom {
 
 // This is an internal helper class and should not be used outside of this header.
 struct AudioTimelineEvent {
-  enum Type MOZ_ENUM_TYPE(uint32_t) {
+  enum Type : uint32_t {
     SetValue,
     LinearRamp,
     ExponentialRamp,
     SetTarget,
     SetValueCurve
   };
 
   AudioTimelineEvent(Type aType, double aTime, float aValue, double aTimeConstant = 0.0,
--- a/dom/svg/SVGPreserveAspectRatio.h
+++ b/dom/svg/SVGPreserveAspectRatio.h
@@ -12,17 +12,17 @@
 #include "nsWrapperCache.h"
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/ErrorResult.h"
 #include "nsSVGElement.h"
 
 namespace mozilla {
 // Alignment Types
-enum SVGAlign MOZ_ENUM_TYPE(uint8_t) {
+enum SVGAlign : uint8_t {
   SVG_PRESERVEASPECTRATIO_UNKNOWN = 0,
   SVG_PRESERVEASPECTRATIO_NONE = 1,
   SVG_PRESERVEASPECTRATIO_XMINYMIN = 2,
   SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3,
   SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4,
   SVG_PRESERVEASPECTRATIO_XMINYMID = 5,
   SVG_PRESERVEASPECTRATIO_XMIDYMID = 6,
   SVG_PRESERVEASPECTRATIO_XMAXYMID = 7,
@@ -32,17 +32,17 @@ enum SVGAlign MOZ_ENUM_TYPE(uint8_t) {
 };
 
 // These constants represent the range of valid enum values for the <align>
 // parameter. They exclude the sentinel _UNKNOWN value.
 const uint16_t SVG_ALIGN_MIN_VALID = SVG_PRESERVEASPECTRATIO_NONE;
 const uint16_t SVG_ALIGN_MAX_VALID = SVG_PRESERVEASPECTRATIO_XMAXYMAX;
 
 // Meet-or-slice Types
-enum SVGMeetOrSlice MOZ_ENUM_TYPE(uint8_t) {
+enum SVGMeetOrSlice : uint8_t {
   SVG_MEETORSLICE_UNKNOWN = 0,
   SVG_MEETORSLICE_MEET = 1,
   SVG_MEETORSLICE_SLICE = 2
 };
 
 // These constants represent the range of valid enum values for the
 // <meetOrSlice> parameter. They exclude the sentinel _UNKNOWN value.
 const uint16_t SVG_MEETORSLICE_MIN_VALID = SVG_MEETORSLICE_MEET;
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -288,17 +288,17 @@ public:
     /*
      * If the data this constraint refers to is still live, copy it into the
      * zone's new allocator. Type constraints only hold weak references.
      */
     virtual bool sweep(TypeZone &zone, TypeConstraint **res) = 0;
 };
 
 /* Flags and other state stored in TypeSet::flags */
-enum MOZ_ENUM_TYPE(uint32_t) {
+enum : uint32_t {
     TYPE_FLAG_UNDEFINED =   0x1,
     TYPE_FLAG_NULL      =   0x2,
     TYPE_FLAG_BOOLEAN   =   0x4,
     TYPE_FLAG_INT32     =   0x8,
     TYPE_FLAG_DOUBLE    =  0x10,
     TYPE_FLAG_STRING    =  0x20,
     TYPE_FLAG_SYMBOL    =  0x40,
     TYPE_FLAG_LAZYARGS  =  0x80,
@@ -347,17 +347,17 @@ enum MOZ_ENUM_TYPE(uint32_t) {
      * Otherwise these bits are clear.
      */
     TYPE_FLAG_DEFINITE_MASK       = 0xfffc0000,
     TYPE_FLAG_DEFINITE_SHIFT      = 18
 };
 typedef uint32_t TypeFlags;
 
 /* Flags and other state stored in TypeObject::flags */
-enum MOZ_ENUM_TYPE(uint32_t) {
+enum : uint32_t {
     /* Whether this type object is associated with some allocation site. */
     OBJECT_FLAG_FROM_ALLOCATION_SITE  = 0x1,
 
     /*
      * If set, the object's prototype might be in the nursery and can't be
      * used during Ion compilation (which may be occurring off thread).
      */
     OBJECT_FLAG_NURSERY_PROTO         = 0x2,
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -60,17 +60,17 @@ using JS::CanonicalizeNaN;
 // value of JS_STRUCTURED_CLONE_VERSION in js/public/StructuredClone.h.  You will
 // likely need to increment the version if anything at all changes in the serialization
 // format.
 //
 // Note that SCTAG_END_OF_KEYS is written into the serialized form and should have
 // a stable ID, it need not be at the end of the list and should not be used for
 // sizing data structures.
 
-enum StructuredDataType MOZ_ENUM_TYPE(uint32_t) {
+enum StructuredDataType : uint32_t {
     /* Structured data types provided by the engine */
     SCTAG_FLOAT_MAX = 0xFFF00000,
     SCTAG_NULL = 0xFFFF0000,
     SCTAG_UNDEFINED,
     SCTAG_BOOLEAN,
     SCTAG_INT32,
     SCTAG_STRING,
     SCTAG_DATE_OBJECT,
--- a/mfbt/TypedEnum.h
+++ b/mfbt/TypedEnum.h
@@ -10,41 +10,16 @@
 #define mozilla_TypedEnum_h
 
 #include "mozilla/TypedEnumInternal.h"
 #include "mozilla/MacroArgs.h"
 
 #if defined(__cplusplus)
 
 /**
- * MOZ_ENUM_TYPE specifies the underlying numeric type for an enum.  It's
- * specified by placing MOZ_ENUM_TYPE(type) immediately after the enum name in
- * its declaration, and before the opening curly brace, like
- *
- *   enum MyEnum MOZ_ENUM_TYPE(uint16_t)
- *   {
- *     A,
- *     B = 7,
- *     C
- *   };
- *
- * In supporting compilers, the macro will expand to ": uint16_t".  The
- * compiler will allocate exactly two bytes for MyEnum and will require all
- * enumerators to have values between 0 and 65535.  (Thus specifying "B =
- * 100000" instead of "B = 7" would fail to compile.)  In old compilers the
- * macro expands to the empty string, and the underlying type is generally
- * undefined.
- */
-#ifdef MOZ_HAVE_CXX11_ENUM_TYPE
-#  define MOZ_ENUM_TYPE(type)   : type
-#else
-#  define MOZ_ENUM_TYPE(type)   /* no support */
-#endif
-
-/**
  * MOZ_BEGIN_ENUM_CLASS and MOZ_END_ENUM_CLASS provide access to the
  * strongly-typed enumeration feature of C++11 ("enum class").  If supported
  * by the compiler, an enum defined using these macros will not be implicitly
  * converted to any other type, and its enumerators will be scoped using the
  * enumeration name.  Place MOZ_BEGIN_ENUM_CLASS(EnumName [, type]) in place of
  * "enum EnumName {", and MOZ_END_ENUM_CLASS(EnumName) in place of the closing
  * "};".  For example,
  *
@@ -150,17 +125,17 @@
      public: \
        enum Enum \
        {
    /* Two-argument form. */
 #  define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER2(Name, type) \
      class Name \
      { \
      public: \
-       enum Enum MOZ_ENUM_TYPE(type) \
+       enum Enum : type \
        {
 #  define MOZ_END_NESTED_ENUM_CLASS(Name) \
        }; \
        Name() {} \
        MOZ_CONSTEXPR Name(Enum aEnum) : mEnum(aEnum) {} \
        template<typename Other> \
        explicit MOZ_CONSTEXPR Name(Other num) : mEnum((Enum)num) {} \
        MOZ_CONSTEXPR operator Enum() const { return mEnum; } \
--- a/mfbt/TypedEnumInternal.h
+++ b/mfbt/TypedEnumInternal.h
@@ -21,28 +21,25 @@
     * Per Clang documentation, "Note that marketing version numbers should not
     * be used to check for language features, as different vendors use different
     * numbering schemes. Instead, use the feature checking macros."
     */
 #  ifndef __has_extension
 #    define __has_extension __has_feature /* compatibility, for older versions of clang */
 #  endif
 #  if __has_extension(cxx_strong_enums)
-#    define MOZ_HAVE_CXX11_ENUM_TYPE
 #    define MOZ_HAVE_CXX11_STRONG_ENUMS
 #  endif
 #elif defined(__GNUC__)
 #  if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
 #    if MOZ_GCC_VERSION_AT_LEAST(4, 6, 3)
-#      define MOZ_HAVE_CXX11_ENUM_TYPE
 #      define MOZ_HAVE_CXX11_STRONG_ENUMS
 #    endif
 #  endif
 #elif defined(_MSC_VER)
-#  define MOZ_HAVE_CXX11_ENUM_TYPE
 #  define MOZ_HAVE_CXX11_STRONG_ENUMS
 #endif
 
 namespace mozilla {
 
 /*
  * The problem that CastableTypedEnumResult aims to solve is that
  * typed enums are not convertible to bool, and there is no way to make them
--- a/uriloader/prefetch/nsOfflineCacheUpdate.h
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.h
@@ -71,17 +71,17 @@ public:
 
     bool IsInProgress();
     bool IsScheduled();
     bool IsCompleted();
 
     nsresult GetStatus(uint16_t *aStatus);
 
 private:
-    enum LoadStatus MOZ_ENUM_TYPE(uint16_t) {
+    enum LoadStatus : uint16_t {
       UNINITIALIZED = 0U,
       REQUESTED = 1U,
       RECEIVING = 2U,
       LOADED = 3U
     };
 
     nsRefPtr<nsOfflineCacheUpdate> mUpdate;
     nsCOMPtr<nsIChannel>           mChannel;
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -27,17 +27,17 @@ enum nsEventStatus
   // The event is consumed, but do default processing
   nsEventStatus_eConsumeDoDefault
 };
 
 namespace mozilla {
 
 typedef uint8_t EventClassIDType;
 
-enum EventClassID MOZ_ENUM_TYPE(EventClassIDType)
+enum EventClassID : EventClassIDType
 {
   // The event class name will be:
   //   eBasicEventClass for WidgetEvent
   //   eFooEventClass for WidgetFooEvent or InternalFooEvent
 #define NS_ROOT_EVENT_CLASS(aPrefix, aName)   eBasic##aName##Class
 #define NS_EVENT_CLASS(aPrefix, aName)      , e##aName##Class
 
 #include "mozilla/EventClassList.h"
@@ -72,17 +72,17 @@ enum CodeNameIndex
   CODE_NAME_INDEX_USE_STRING
 };
 
 #undef NS_DEFINE_PHYSICAL_KEY_CODE_NAME
 
 #define NS_DEFINE_COMMAND(aName, aCommandStr) , Command##aName
 
 typedef int8_t CommandInt;
-enum Command MOZ_ENUM_TYPE(CommandInt)
+enum Command : CommandInt
 {
   CommandDoNothing
 
 #include "mozilla/CommandList.h"
 };
 #undef NS_DEFINE_COMMAND
 
 } // namespace mozilla
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -220,17 +220,17 @@ enum nsTopLevelWidgetZPlacement { // for
  * they should set mWantUpdates to NOTIFY_NOTHING to avoid the cost.
  * If the IME implementation needs notifications even while our process is
  * deactive, it should also set NOTIFY_DURING_DEACTIVE.
  */
 struct nsIMEUpdatePreference {
 
   typedef uint8_t Notifications;
 
-  enum MOZ_ENUM_TYPE(Notifications)
+  enum : Notifications
   {
     NOTIFY_NOTHING                       = 0,
     NOTIFY_SELECTION_CHANGE              = 1 << 0,
     NOTIFY_TEXT_CHANGE                   = 1 << 1,
     NOTIFY_POSITION_CHANGE               = 1 << 2,
     // NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR is used when mouse button is pressed
     // or released on a character in the focused editor.  The notification is
     // notified to IME as a mouse event.  If it's consumed by IME, NotifyIME()
@@ -514,17 +514,17 @@ struct SizeConstraints {
   nsIntSize mMinSize;
   nsIntSize mMaxSize;
 };
 
 // IMEMessage is shared by IMEStateManager and TextComposition.
 // Update values in GeckoEditable.java if you make changes here.
 // XXX Negative values are used in Android...
 typedef int8_t IMEMessageType;
-enum IMEMessage MOZ_ENUM_TYPE(IMEMessageType)
+enum IMEMessage : IMEMessageType
 {
   // An editable content is getting focus
   NOTIFY_IME_OF_FOCUS = 1,
   // An editable content is losing focus
   NOTIFY_IME_OF_BLUR,
   // Selection in the focused editable content is changed
   NOTIFY_IME_OF_SELECTION_CHANGE,
   // Text in the focused editable content is changed
--- a/widget/windows/nsTextStore.h
+++ b/widget/windows/nsTextStore.h
@@ -475,17 +475,17 @@ protected:
   // mSelection with the selection at the first call during a lock and returns
   // it.  However, mSelection is NOT modified immediately.  When pending
   // changes are flushed at unlocking the document, cached mSelection is
   // modified.  Note that this is also called by LockedContent().
   Selection& CurrentSelection();
 
   struct PendingAction MOZ_FINAL
   {
-    enum ActionType MOZ_ENUM_TYPE(uint8_t)
+    enum ActionType : uint8_t
     {
       COMPOSITION_START,
       COMPOSITION_UPDATE,
       COMPOSITION_END,
       SELECTION_SET
     };
     ActionType mType;
     // For compositionstart and selectionset
@@ -630,17 +630,17 @@ protected:
     nsTextStore::Selection& Selection() { return mSelection; }
 
   private:
     nsString mText;
     nsTextStore::Composition& mComposition;
     nsTextStore::Selection& mSelection;
 
     // The minimum offset of modified part of the text.
-    enum MOZ_ENUM_TYPE(uint32_t)
+    enum : uint32_t
     {
       NOT_MODIFIED = UINT32_MAX
     };
     uint32_t mMinTextModifiedOffset;
 
     bool mInitialized;
   };
   // mLockedContent caches content of the document ONLY while the document
--- a/xpcom/base/nsError.h
+++ b/xpcom/base/nsError.h
@@ -131,39 +131,24 @@
     #undef ERROR
   } nsresult;
 
   /*
    * enum classes don't place their initializers in the global scope, so we need
    * #define's for compatibility with old code.
    */
   #include "ErrorListCxxDefines.h"
-#elif defined(MOZ_HAVE_CXX11_ENUM_TYPE)
+#elif defined(__cplusplus)
   typedef enum tag_nsresult : uint32_t
   {
     #undef ERROR
     #define ERROR(key, val) key = val
     #include "ErrorList.h"
     #undef ERROR
   } nsresult;
-#elif defined(__cplusplus)
-  /*
-   * We're C++ in an old compiler lacking enum classes *and* typed enums (likely
-   * gcc < 4.5.1 as clang/MSVC have long supported one or both), or compiler
-   * support is unknown.  Yet nsresult must have unsigned 32-bit representation.
-   * So just make it a typedef, and implement the constants with global consts.
-   */
-  typedef uint32_t nsresult;
-
-  const nsresult
-  #undef ERROR
-  #define ERROR(key, val) key = val
-  #include "ErrorList.h"
-  #undef ERROR
-    ;
 #else
   /*
    * C doesn't have any way to fix the type underlying an enum, and enum
    * initializers can't have values outside the range of 'int'.  So typedef
    * nsresult to the correct unsigned type, and fall back to using #defines for
    * all error constants.
    */
   typedef uint32_t nsresult;