Bug 1111290 - Part 3: Remove TypedEnum.h and fold TypedEnumInternal.h into TypedEnumBits.h. r=waldo
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Mon, 26 Jan 2015 07:22:11 +0900
changeset 225630 7f7f003696ad7bccde5ebcaf4cc122cc60e887f4
parent 225629 2fab2faa7f9d5778fcb5aa3a733a96f4350de90c
child 225631 6ff2bc5f6f0ca530b200fa39ea9806aab504065a
push id10990
push usercbook@mozilla.com
push dateMon, 26 Jan 2015 14:06:38 +0000
treeherderfx-team@54be9bcdacd9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1111290
milestone38.0a1
Bug 1111290 - Part 3: Remove TypedEnum.h and fold TypedEnumInternal.h into TypedEnumBits.h. r=waldo
accessible/base/RelationType.h
dom/bindings/Codegen.py
dom/canvas/WebGLTypes.h
dom/events/EventStateManager.h
dom/html/HTMLCanvasElement.h
dom/media/MediaDecoderReader.h
dom/media/webaudio/AudioEventTimeline.h
dom/svg/SVGPreserveAspectRatio.h
dom/workers/ServiceWorkerManager.h
editor/libeditor/nsEditor.h
gfx/2d/Logging.h
gfx/2d/PathHelpers.h
gfx/2d/Types.h
gfx/gl/AndroidNativeWindow.h
gfx/gl/GLContextTypes.h
gfx/gl/SurfaceTypes.h
gfx/ipc/GfxMessageUtils.h
gfx/layers/CompositorTypes.h
gfx/layers/ImageTypes.h
gfx/layers/LayersTypes.h
gfx/src/FilterSupport.h
gfx/src/nsRegion.h
gfx/thebes/DrawMode.h
gfx/thebes/GraphicsFilter.h
gfx/thebes/gfxPrefs.h
gfx/thebes/gfxTypes.h
image/decoders/EXIF.h
image/src/DecodePool.h
image/src/Orientation.h
image/src/RasterImage.h
image/src/imgFrame.h
ipc/glue/IPCMessageUtils.h
js/public/ProfilingStack.h
js/src/frontend/FoldConstants.cpp
js/src/jit/IonTypes.h
js/src/jsapi.h
js/src/jsfriendapi.h
js/src/jsinfer.h
js/src/vm/StructuredClone.cpp
layout/generic/nsIFrame.h
layout/style/nsCSSRuleProcessor.cpp
mfbt/EnumeratedArray.h
mfbt/TypedEnum.h
mfbt/TypedEnumBits.h
mfbt/TypedEnumInternal.h
mfbt/moz.build
mfbt/tests/TestTypedEnum.cpp
widget/EventForwards.h
widget/cocoa/VibrancyManager.h
xpcom/base/nsError.h
xpcom/glue/pldhash.h
--- a/accessible/base/RelationType.h
+++ b/accessible/base/RelationType.h
@@ -2,18 +2,16 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_relationtype_h_
 #define mozilla_a11y_relationtype_h_
 
-#include "mozilla/TypedEnum.h"
-
 namespace mozilla {
 namespace a11y {
 
 enum class RelationType {
 
   /**
    * This object is labelled by a target object.
    */
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -8435,20 +8435,20 @@ class CGEnum(CGThing):
         return self.enum.identifier.name + "Values"
 
     def nEnumStrings(self):
         return len(self.enum.values()) + 1
 
     def declare(self):
         decl = fill(
             """
-            MOZ_BEGIN_ENUM_CLASS(${name}, uint32_t)
+            enum class ${name} : uint32_t {
               $*{enums}
               EndGuard_
-            MOZ_END_ENUM_CLASS(${name})
+            };
             """,
             name=self.enum.identifier.name,
             enums=",\n".join(map(getEnumValueName, self.enum.values())) + ",\n")
         strings = CGNamespace(self.stringsNamespace(),
                               CGGeneric(declare="extern const EnumEntry %s[%d];\n"
                                         % (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings())))
         return decl + "\n" + strings.declare()
 
--- a/dom/canvas/WebGLTypes.h
+++ b/dom/canvas/WebGLTypes.h
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WEBGLTYPES_H_
 #define WEBGLTYPES_H_
 
-#include "mozilla/TypedEnum.h"
-
 // Most WebIDL typedefs are identical to their OpenGL counterparts.
 #include "GLTypes.h"
 
 // Manual reflection of WebIDL typedefs that are different from their
 // OpenGL counterparts.
 typedef int64_t WebGLsizeiptr;
 typedef int64_t WebGLintptr;
 typedef bool WebGLboolean;
--- a/dom/events/EventStateManager.h
+++ b/dom/events/EventStateManager.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_EventStateManager_h_
 #define mozilla_EventStateManager_h_
 
 #include "mozilla/EventForwards.h"
-#include "mozilla/TypedEnum.h"
 
 #include "nsIObserver.h"
 #include "nsWeakReference.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/TimeStamp.h"
 #include "nsIFrame.h"
--- a/dom/html/HTMLCanvasElement.h
+++ b/dom/html/HTMLCanvasElement.h
@@ -2,17 +2,16 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #if !defined(mozilla_dom_HTMLCanvasElement_h)
 #define mozilla_dom_HTMLCanvasElement_h
 
 #include "mozilla/Attributes.h"
-#include "mozilla/TypedEnum.h"
 #include "nsIDOMHTMLCanvasElement.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsSize.h"
 #include "nsError.h"
 
 #include "mozilla/gfx/Rect.h"
 
--- a/dom/media/MediaDecoderReader.h
+++ b/dom/media/MediaDecoderReader.h
@@ -8,18 +8,16 @@
 
 #include "AbstractMediaDecoder.h"
 #include "MediaInfo.h"
 #include "MediaData.h"
 #include "MediaPromise.h"
 #include "MediaQueue.h"
 #include "AudioCompactor.h"
 
-#include "mozilla/TypedEnum.h"
-
 namespace mozilla {
 
 namespace dom {
 class TimeRanges;
 }
 
 class MediaDecoderReader;
 class SharedDecoderManager;
--- a/dom/media/webaudio/AudioEventTimeline.h
+++ b/dom/media/webaudio/AudioEventTimeline.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef AudioEventTimeline_h_
 #define AudioEventTimeline_h_
 
 #include <algorithm>
 #include "mozilla/Assertions.h"
 #include "mozilla/FloatingPoint.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/PodOperations.h"
 
 #include "nsTArray.h"
 #include "math.h"
 #include "WebAudioUtils.h"
 
 namespace mozilla {
 
--- a/dom/svg/SVGPreserveAspectRatio.h
+++ b/dom/svg/SVGPreserveAspectRatio.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_
 #define MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_
 
 #include "mozilla/HashFunctions.h"  // for HashGeneric
-#include "mozilla/TypedEnum.h"
 
 #include "nsWrapperCache.h"
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/ErrorResult.h"
 #include "nsSVGElement.h"
 
 namespace mozilla {
--- a/dom/workers/ServiceWorkerManager.h
+++ b/dom/workers/ServiceWorkerManager.h
@@ -6,17 +6,16 @@
 #define mozilla_dom_workers_serviceworkermanager_h
 
 #include "nsIServiceWorkerManager.h"
 #include "nsCOMPtr.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/dom/ServiceWorkerBinding.h" // For ServiceWorkerState
 #include "mozilla/dom/ServiceWorkerCommon.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
--- a/editor/libeditor/nsEditor.h
+++ b/editor/libeditor/nsEditor.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __editor_h__
 #define __editor_h__
 
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc.
-#include "mozilla/TypedEnum.h"          // for MOZ_BEGIN_ENUM_CLASS, etc.
 #include "mozilla/dom/Text.h"
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMArray.h"                 // for nsCOMArray
 #include "nsCOMPtr.h"                   // for already_AddRefed, nsCOMPtr
 #include "nsCycleCollectionParticipant.h"
 #include "nsGkAtoms.h"
 #include "nsIEditor.h"                  // for nsIEditor::EDirection, etc
 #include "nsIEditorIMESupport.h"        // for NS_DECL_NSIEDITORIMESUPPORT, etc
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -16,17 +16,16 @@
 #endif
 
 #if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)
 #include "nsDebug.h"
 #endif
 #include "Point.h"
 #include "BaseRect.h"
 #include "Matrix.h"
-#include "mozilla/TypedEnum.h"
 
 #ifdef WIN32
 // This file gets included from nsGlobalWindow.cpp, which doesn't like
 // having windows.h included in it. Since OutputDebugStringA is the only
 // thing we need from windows.h, we just declare it here directly.
 // Note: the function's documented signature is
 //  WINBASEAPI void WINAPI OutputDebugStringA(LPCSTR lpOutputString)
 // but if we don't include windows.h, the macros WINBASEAPI, WINAPI, and 
--- a/gfx/2d/PathHelpers.h
+++ b/gfx/2d/PathHelpers.h
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_PATHHELPERS_H_
 #define MOZILLA_GFX_PATHHELPERS_H_
 
 #include "2D.h"
 #include "mozilla/Constants.h"
-#include "mozilla/TypedEnum.h"
 #include "UserData.h"
 
 namespace mozilla {
 namespace gfx {
 
 template <typename T>
 void ArcToBezier(T* aSink, const Point &aOrigin, const Size &aRadius,
                  float aStartAngle, float aEndAngle, bool aAntiClockwise)
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_TYPES_H_
 #define MOZILLA_GFX_TYPES_H_
 
-#include "mozilla/TypedEnum.h"
-
 #include <stddef.h>
 #include <stdint.h>
 
 namespace mozilla {
 namespace gfx {
 
 typedef float Float;
 
--- a/gfx/gl/AndroidNativeWindow.h
+++ b/gfx/gl/AndroidNativeWindow.h
@@ -7,17 +7,16 @@
 #ifndef AndroidNativeWindow_h__
 #define AndroidNativeWindow_h__
 #ifdef MOZ_WIDGET_ANDROID
 
 #include <jni.h>
 #include "GLDefs.h"
 
 #include "nsISupports.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/gfx/2D.h"
 
 
 namespace mozilla {
 namespace gl {
 
 enum class AndroidWindowFormat {
   Unknown = -1,
--- a/gfx/gl/GLContextTypes.h
+++ b/gfx/gl/GLContextTypes.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GLCONTEXT_TYPES_H_
 #define GLCONTEXT_TYPES_H_
 
 #include "GLTypes.h"
-#include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 namespace gl {
 
 class GLContext;
 
 enum class GLContextType {
     Unknown,
--- a/gfx/gl/SurfaceTypes.h
+++ b/gfx/gl/SurfaceTypes.h
@@ -1,17 +1,16 @@
 /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef SURFACE_TYPES_H_
 #define SURFACE_TYPES_H_
 
-#include "mozilla/TypedEnum.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Attributes.h"
 #include <stdint.h>
 
 namespace mozilla {
 namespace layers {
 class ISurfaceAllocator;
 }
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -29,23 +29,17 @@
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4800 )
 #endif
 
 namespace mozilla {
 
 typedef gfxImageFormat PixelFormat;
-#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
 typedef ::GraphicsFilter GraphicsFilterType;
-#else
-// If we don't have support for enum classes, then we need to use the actual
-// enum type here instead of the simulated enum class.
-typedef GraphicsFilter::Enum GraphicsFilterType;
-#endif
 
 } // namespace mozilla
 
 namespace IPC {
 
 template<>
 struct ParamTraits<mozilla::gfx::Matrix>
 {
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -8,17 +8,16 @@
 
 #include <stdint.h>                     // for uint32_t
 #include <sys/types.h>                  // for int32_t
 #include "LayersTypes.h"                // for LayersBackend, etc
 #include "nsXULAppAPI.h"                // for GeckoProcessType, etc
 #include "mozilla/gfx/Types.h"
 #include "mozilla/EnumSet.h"
 
-#include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 
 namespace mozilla {
 namespace layers {
 
 /**
  * Flags used by texture clients and texture hosts. These are passed from client
  * side to host side when textures and compositables are created. Usually set
--- a/gfx/layers/ImageTypes.h
+++ b/gfx/layers/ImageTypes.h
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_IMAGETYPES_H
 #define GFX_IMAGETYPES_H
 
-#include "mozilla/TypedEnum.h"
-
 namespace mozilla {
 
 enum class ImageFormat {
   /**
    * The PLANAR_YCBCR format creates a PlanarYCbCrImage. All backends should
    * support this format, because the Ogg video decoder depends on it.
    * The maximum image width and height is 16384.
    */
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -5,17 +5,16 @@
 
 #ifndef GFX_LAYERSTYPES_H
 #define GFX_LAYERSTYPES_H
 
 #include <stdint.h>                     // for uint32_t
 #include "nsPoint.h"                    // for nsIntPoint
 #include "nsRegion.h"
 
-#include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include <ui/GraphicBuffer.h>
 #endif
 #if defined(DEBUG) || defined(PR_LOGGING)
 #  include <stdio.h>            // FILE
 #  include "prlog.h"            // for PR_LOG
--- a/gfx/src/FilterSupport.h
+++ b/gfx/src/FilterSupport.h
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __FilterSupport_h
 #define __FilterSupport_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/RefPtr.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/gfx/Matrix.h"
 #include "mozilla/gfx/2D.h"
 #include "nsClassHashtable.h"
 #include "nsTArray.h"
 #include "nsRegion.h"
 
 namespace mozilla {
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -13,17 +13,16 @@
 #include "mozilla/ToString.h"           // for mozilla::ToString
 #include "nsCoord.h"                    // for nscoord
 #include "nsError.h"                    // for nsresult
 #include "nsPoint.h"                    // for nsIntPoint, nsPoint
 #include "nsRect.h"                     // for nsIntRect, nsRect
 #include "nsMargin.h"                   // for nsIntMargin
 #include "nsStringGlue.h"               // for nsCString
 #include "xpcom-config.h"               // for CPP_THROW_NEW
-#include "mozilla/TypedEnum.h"          // for the VisitEdges typed enum
 #include "mozilla/Move.h"               // for mozilla::Move
 
 class nsIntRegion;
 class gfx3DMatrix;
 
 #include "pixman.h"
 
 /* For information on the internal representation look at pixman-region.c
--- a/gfx/thebes/DrawMode.h
+++ b/gfx/thebes/DrawMode.h
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef DrawMode_h
 #define DrawMode_h
 
-#include "mozilla/TypedEnum.h"
-
 // Options for how the text should be drawn
 enum class DrawMode : int {
   // GLYPH_FILL and GLYPH_STROKE draw into the current context
   //  and may be used together with bitwise OR.
   GLYPH_FILL = 1,
   // Note: using GLYPH_STROKE will destroy the current path.
   GLYPH_STROKE = 2,
   // Appends glyphs to the current path. Can NOT be used with
--- a/gfx/thebes/GraphicsFilter.h
+++ b/gfx/thebes/GraphicsFilter.h
@@ -1,18 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GraphicsFilter_h
 #define GraphicsFilter_h
 
-#include "mozilla/TypedEnum.h"
-
 enum class GraphicsFilter : int {
   FILTER_FAST,
   FILTER_GOOD,
   FILTER_BEST,
   FILTER_NEAREST,
   FILTER_BILINEAR,
   FILTER_GAUSSIAN,
   FILTER_SENTINEL
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_PREFS_H
 #define GFX_PREFS_H
 
 #include <stdint.h>
 #include "mozilla/Assertions.h"
 #include "mozilla/Constants.h"   // for M_PI
-#include "mozilla/TypedEnum.h"
 
 // First time gfxPrefs::GetSingleton() needs to be called on the main thread,
 // before any of the methods accessing the values are used, but after
 // the Preferences system has been initialized.
 
 // The static methods to access the preference value are safe to call
 // from any thread after that first call.
 
--- a/gfx/thebes/gfxTypes.h
+++ b/gfx/thebes/gfxTypes.h
@@ -2,17 +2,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_TYPES_H
 #define GFX_TYPES_H
 
 #include <stdint.h>
-#include "mozilla/TypedEnum.h"
 
 typedef struct _cairo_surface cairo_surface_t;
 typedef struct _cairo_user_data_key cairo_user_data_key_t;
 
 typedef void (*thebes_destroy_func_t) (void *data);
 
 /**
  * Currently needs to be 'double' for Cairo compatibility. Could
--- a/image/decoders/EXIF.h
+++ b/image/decoders/EXIF.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_IMAGELIB_EXIF_H
 #define MOZILLA_IMAGELIB_EXIF_H
 
 #include <stdint.h>
-#include "mozilla/TypedEnum.h"
 #include "nsDebug.h"
 
 #include "Orientation.h"
 
 namespace mozilla {
 namespace image {
 
 enum class ByteOrder : uint8_t {
--- a/image/src/DecodePool.h
+++ b/image/src/DecodePool.h
@@ -7,17 +7,16 @@
  * DecodePool manages the threads used for decoding raster images.
  */
 
 #ifndef MOZILLA_IMAGELIB_DECODEPOOL_H_
 #define MOZILLA_IMAGELIB_DECODEPOOL_H_
 
 #include "mozilla/Mutex.h"
 #include "mozilla/StaticPtr.h"
-#include <mozilla/TypedEnum.h>
 #include "nsCOMPtr.h"
 #include "nsIEventTarget.h"
 #include "nsIObserver.h"
 
 class nsIThread;
 class nsIThreadPool;
 
 namespace mozilla {
--- a/image/src/Orientation.h
+++ b/image/src/Orientation.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_IMAGELIB_ORIENTATION_H_
 #define MOZILLA_IMAGELIB_ORIENTATION_H_
 
 #include <stdint.h>
-#include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 namespace image {
 
 enum class Angle : uint8_t {
   D0,
   D90,
   D180,
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -25,17 +25,16 @@
 #include "imgFrame.h"
 #include "nsThreadUtils.h"
 #include "DecodePool.h"
 #include "Orientation.h"
 #include "nsIObserver.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/TimeStamp.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/WeakPtr.h"
 #include "mozilla/UniquePtr.h"
 #ifdef DEBUG
   #include "imgIContainerDebug.h"
 #endif
 
 class nsIInputStream;
 class nsIThreadPool;
--- a/image/src/imgFrame.h
+++ b/image/src/imgFrame.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef imgFrame_h
 #define imgFrame_h
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Move.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/VolatileBuffer.h"
 #include "gfxDrawable.h"
 #include "imgIContainer.h"
 #include "MainThreadUtils.h"
 
 namespace mozilla {
 namespace image {
 
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -11,17 +11,16 @@
 #include "chrome/common/ipc_message_utils.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/TimeStamp.h"
 #ifdef XP_WIN
 #include "mozilla/TimeStamp_windows.h"
 #endif
-#include "mozilla/TypedEnum.h"
 #include "mozilla/TypeTraits.h"
 #include "mozilla/IntegerTypeTraits.h"
 
 #include <stdint.h>
 
 #include "nsID.h"
 #include "nsMemory.h"
 #include "nsString.h"
--- a/js/public/ProfilingStack.h
+++ b/js/public/ProfilingStack.h
@@ -2,18 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef js_ProfilingStack_h
 #define js_ProfilingStack_h
 
-#include "mozilla/TypedEnum.h"
-
 #include "jsbytecode.h"
 #include "jstypes.h"
 
 #include "js/Utility.h"
 
 struct JSRuntime;
 
 namespace js {
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -2,17 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "frontend/FoldConstants.h"
 
 #include "mozilla/FloatingPoint.h"
-#include "mozilla/TypedEnum.h"
 
 #include "jslibmath.h"
 
 #include "frontend/ParseNode.h"
 #include "frontend/Parser.h"
 #include "js/Conversions.h"
 
 #include "jscntxtinlines.h"
--- a/js/src/jit/IonTypes.h
+++ b/js/src/jit/IonTypes.h
@@ -3,17 +3,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_IonTypes_h
 #define jit_IonTypes_h
 
 #include "mozilla/HashFunctions.h"
-#include "mozilla/TypedEnum.h"
 
 #include "jstypes.h"
 
 #include "js/Value.h"
 
 namespace js {
 namespace jit {
 
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -8,17 +8,16 @@
 
 #ifndef jsapi_h
 #define jsapi_h
 
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Range.h"
 #include "mozilla/RangedPtr.h"
-#include "mozilla/TypedEnum.h"
 
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
 #include <stdio.h>
 
 #include "jsalloc.h"
 #include "jspubtd.h"
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -4,17 +4,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jsfriendapi_h
 #define jsfriendapi_h
 
 #include "mozilla/Casting.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/UniquePtr.h"
 
 #include "jsapi.h" // For JSAutoByteString.  See bug 1033916.
 #include "jsbytecode.h"
 #include "jspubtd.h"
 
 #include "js/CallArgs.h"
 #include "js/CallNonGenericMethod.h"
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* Definitions related to javascript type inference. */
 
 #ifndef jsinfer_h
 #define jsinfer_h
 
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/TypedEnum.h"
 
 #include "jsalloc.h"
 #include "jsfriendapi.h"
 #include "jstypes.h"
 
 #include "ds/IdValuePair.h"
 #include "ds/LifoAlloc.h"
 #include "gc/Barrier.h"
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -26,17 +26,16 @@
  * the ArrayBuffer has been read, then it is updated with the actual typed
  * array object.
  */
 
 #include "js/StructuredClone.h"
 
 #include "mozilla/Endian.h"
 #include "mozilla/FloatingPoint.h"
-#include "mozilla/TypedEnum.h"
 
 #include <algorithm>
 
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsdate.h"
 #include "jswrapper.h"
 
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -23,17 +23,16 @@
 #include <stdio.h>
 #include "nsQueryFrame.h"
 #include "nsStyleContext.h"
 #include "nsStyleStruct.h"
 #include "nsHTMLReflowMetrics.h"
 #include "nsFrameList.h"
 #include "mozilla/layout/FrameChildList.h"
 #include "FramePropertyTable.h"
-#include "mozilla/TypedEnum.h"
 #include "nsDirection.h"
 #include "WritingModes.h"
 #include <algorithm>
 #include "nsITheme.h"
 #include "nsLayoutUtils.h"
 #include "nsFrameState.h"
 #include "CaretAssociationHint.h"
 
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -48,17 +48,16 @@
 #include "nsStyleSet.h"
 #include "mozilla/dom/Element.h"
 #include "nsNthIndexCache.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/Likely.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
 
 static bool gSupportVisitedPseudo = true;
--- a/mfbt/EnumeratedArray.h
+++ b/mfbt/EnumeratedArray.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* EnumeratedArray is like Array, but indexed by a typed enum. */
 
 #ifndef mozilla_EnumeratedArray_h
 #define mozilla_EnumeratedArray_h
 
 #include "mozilla/Array.h"
-#include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 
 /**
  * EnumeratedArray is a fixed-size array container for use when an
  * array is indexed by a specific enum class.
  *
  * This provides type safety by guarding at compile time against accidentally
deleted file mode 100644
--- a/mfbt/TypedEnum.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* Macros to emulate C++11 typed enums and enum classes. */
-
-#ifndef mozilla_TypedEnum_h
-#define mozilla_TypedEnum_h
-
-#include "mozilla/TypedEnumInternal.h"
-#include "mozilla/MacroArgs.h"
-
-#if defined(__cplusplus)
-
-/**
- * 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,
- *
- *   MOZ_BEGIN_ENUM_CLASS(Enum, int32_t)
- *     A,
- *     B = 6
- *   MOZ_END_ENUM_CLASS(Enum)
- *
- * This will make "Enum::A" and "Enum::B" appear in the global scope, but "A"
- * and "B" will not.  In compilers that support C++11 strongly-typed
- * enumerations, implicit conversions of Enum values to numeric types will
- * fail.  In other compilers, Enum itself will actually be defined as a class,
- * and some implicit conversions will fail while others will succeed.
- *
- * The optional type argument specifies the underlying type for the enum where
- * supported, as with MOZ_ENUM_TYPE().  As with MOZ_ENUM_TYPE(), it will do
- * nothing on compilers that do not support it.
- *
- * MOZ_{BEGIN,END}_ENUM_CLASS doesn't work for defining enum classes nested
- * inside classes.  To define an enum class nested inside another class, use
- * MOZ_{BEGIN,END}_NESTED_ENUM_CLASS, and place a MOZ_FINISH_NESTED_ENUM_CLASS
- * in namespace scope to handle bits that can only be implemented with
- * namespace-scoped code.  For example:
- *
- *   class FooBar
- *   {
- *     MOZ_BEGIN_NESTED_ENUM_CLASS(Enum, int32_t)
- *       A,
- *       B = 6
- *     MOZ_END_NESTED_ENUM_CLASS(Enum)
- *   };
- *
- *   MOZ_FINISH_NESTED_ENUM_CLASS(FooBar::Enum)
- */
-#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
-  /*
-   * All compilers that support strong enums also support an explicit
-   * underlying type, so no extra check is needed.
-   */
-
-   /* Single-argument form. */
-#  define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER1(Name) \
-     enum class Name {
-   /* Two-argument form. */
-#  define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER2(Name, type) \
-     enum class Name : type {
-#  define MOZ_END_NESTED_ENUM_CLASS(Name) \
-     };
-#  define MOZ_FINISH_NESTED_ENUM_CLASS(Name) /* nothing */
-
-  /*
-   * MOZ_ENUM_CLASS_ENUM_TYPE allows using enum classes
-   * as template parameter types. For that, we need integer types.
-   * In the present case where the compiler supports strong enums,
-   * these are already integer types so there is nothing more to do.
-   */
-#  define MOZ_ENUM_CLASS_ENUM_TYPE(Name) Name
-  /*
-   * See the comment below about MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE.
-   */
-#  define MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(Name) Name
-#else
-   /**
-    * We need Name to both name a type, and scope the provided enumerator
-    * names.  Namespaces and classes both provide scoping, but namespaces
-    * aren't types, so we need to use a class that wraps the enum values.  We
-    * have an implicit conversion from the inner enum type to the class, so
-    * statements like
-    *
-    *   Enum x = Enum::A;
-    *
-    * will still work.  We need to define an implicit conversion from the class
-    * to the inner enum as well, so that (for instance) switch statements will
-    * work.  This means that the class can be implicitly converted to a numeric
-    * value as well via the enum type, since C++ allows an implicit
-    * user-defined conversion followed by a standard conversion to still be
-    * implicit.
-    *
-    * We have an explicit constructor from int defined, so that casts like
-    * (Enum)7 will still work.  We also have a zero-argument constructor with
-    * no arguments, so declaration without initialization (like "Enum foo;")
-    * will work.
-    *
-    * Additionally, we'll delete as many operators as possible for the inner
-    * enum type, so statements like this will still fail:
-    *
-    *   f(5 + Enum::B); // deleted operator+
-    *
-    * But we can't prevent things like this, because C++ doesn't allow
-    * overriding conversions or assignment operators for enums:
-    *
-    *   int x = Enum::A;
-    *   int f()
-    *   {
-    *     return Enum::A;
-    *   }
-    */
-
-   /* Single-argument form. */
-#  define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER1(Name) \
-     class Name \
-     { \
-     public: \
-       enum Enum \
-       {
-   /* Two-argument form. */
-#  define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER2(Name, type) \
-     class Name \
-     { \
-     public: \
-       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; } \
-       explicit MOZ_CONSTEXPR Name(const mozilla::CastableTypedEnumResult<Name>& aOther) \
-         : mEnum(aOther.get()) \
-       {} \
-     private: \
-       Enum mEnum; \
-     };
-#  define MOZ_FINISH_NESTED_ENUM_CLASS(Name) \
-     inline int operator+(const int&, const Name::Enum&) = delete; \
-     inline int operator+(const Name::Enum&, const int&) = delete; \
-     inline int operator-(const int&, const Name::Enum&) = delete; \
-     inline int operator-(const Name::Enum&, const int&) = delete; \
-     inline int operator*(const int&, const Name::Enum&) = delete; \
-     inline int operator*(const Name::Enum&, const int&) = delete; \
-     inline int operator/(const int&, const Name::Enum&) = delete; \
-     inline int operator/(const Name::Enum&, const int&) = delete; \
-     inline int operator%(const int&, const Name::Enum&) = delete; \
-     inline int operator%(const Name::Enum&, const int&) = delete; \
-     inline int operator+(const Name::Enum&) = delete; \
-     inline int operator-(const Name::Enum&) = delete; \
-     inline int& operator++(Name::Enum&) = delete; \
-     inline int operator++(Name::Enum&, int) = delete; \
-     inline int& operator--(Name::Enum&) = delete; \
-     inline int operator--(Name::Enum&, int) = delete; \
-     inline bool operator==(const int&, const Name::Enum&) = delete; \
-     inline bool operator==(const Name::Enum&, const int&) = delete; \
-     inline bool operator!=(const int&, const Name::Enum&) = delete; \
-     inline bool operator!=(const Name::Enum&, const int&) = delete; \
-     inline bool operator>(const int&, const Name::Enum&) = delete; \
-     inline bool operator>(const Name::Enum&, const int&) = delete; \
-     inline bool operator<(const int&, const Name::Enum&) = delete; \
-     inline bool operator<(const Name::Enum&, const int&) = delete; \
-     inline bool operator>=(const int&, const Name::Enum&) = delete; \
-     inline bool operator>=(const Name::Enum&, const int&) = delete; \
-     inline bool operator<=(const int&, const Name::Enum&) = delete; \
-     inline bool operator<=(const Name::Enum&, const int&) = delete; \
-     inline bool operator!(const Name::Enum&) = delete; \
-     inline bool operator&&(const bool&, const Name::Enum&) = delete; \
-     inline bool operator&&(const Name::Enum&, const bool&) = delete; \
-     inline bool operator||(const bool&, const Name::Enum&) = delete; \
-     inline bool operator||(const Name::Enum&, const bool&) = delete; \
-     inline int operator&(const int&, const Name::Enum&) = delete; \
-     inline int operator&(const Name::Enum&, const int&) = delete; \
-     inline int operator|(const int&, const Name::Enum&) = delete; \
-     inline int operator|(const Name::Enum&, const int&) = delete; \
-     inline int operator^(const int&, const Name::Enum&) = delete; \
-     inline int operator^(const Name::Enum&, const int&) = delete; \
-     inline int operator<<(const int&, const Name::Enum&) = delete; \
-     inline int operator<<(const Name::Enum&, const int&) = delete; \
-     inline int operator>>(const int&, const Name::Enum&) = delete; \
-     inline int operator>>(const Name::Enum&, const int&) = delete; \
-     inline int& operator+=(int&, const Name::Enum&) = delete; \
-     inline int& operator-=(int&, const Name::Enum&) = delete; \
-     inline int& operator*=(int&, const Name::Enum&) = delete; \
-     inline int& operator/=(int&, const Name::Enum&) = delete; \
-     inline int& operator%=(int&, const Name::Enum&) = delete; \
-     inline int& operator&=(int&, const Name::Enum&) = delete; \
-     inline int& operator|=(int&, const Name::Enum&) = delete; \
-     inline int& operator^=(int&, const Name::Enum&) = delete; \
-     inline int& operator<<=(int&, const Name::Enum&) = delete; \
-     inline int& operator>>=(int&, const Name::Enum&) = delete;
-
-  /*
-   * MOZ_ENUM_CLASS_ENUM_TYPE allows using enum classes
-   * as template parameter types. For that, we need integer types.
-   * In the present case, the integer type is the Enum nested type.
-   */
-#  define MOZ_ENUM_CLASS_ENUM_TYPE(Name) Name::Enum
-  /*
-   * MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE is a variant of MOZ_ENUM_CLASS_ENUM_TYPE
-   * to be used when the enum class at hand depends on template parameters.
-   *
-   * Indeed, if T depends on template parameters, in order to name a nested type
-   * in T, C++ does not allow to just write "T::NestedType". Instead, we have
-   * to write "typename T::NestedType". The role of this macro is to add
-   * this "typename" keywords where needed.
-   *
-   * Example:
-   *
-   *    template<typename T, MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(T) Value>
-   *    struct S {};
-   *
-   *    MOZ_BEGIN_ENUM_CLASS(E)
-   *      Foo,
-   *      Bar
-   *    MOZ_END_ENUM_CLASS(E)
-   *
-   *    S<E, E::Bar> s;
-   *
-   * In this example, the second template parameter to S is meant to be of type
-   * T, but on non-C++11 compilers, type T is a class type, not an integer
-   * type, so it is not accepted as the type of a constant template parameter.
-   * One would then want to use MOZ_ENUM_CLASS_ENUM_TYPE(T), but that doesn't
-   * work either as T depends on template parameters (more specifically here, T
-   * _is_ a template parameter) so as MOZ_ENUM_CLASS_ENUM_TYPE(T) expands to
-   * T::Enum, we are missing the required "typename" keyword. So here,
-   * MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE is needed.
-   */
-#  define MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(Name) typename Name::Enum
-#endif
-
-#  define MOZ_BEGIN_NESTED_ENUM_CLASS_GLUE(a, b) a b
-#  define MOZ_BEGIN_NESTED_ENUM_CLASS(...) \
-     MOZ_BEGIN_NESTED_ENUM_CLASS_GLUE( \
-       MOZ_PASTE_PREFIX_AND_ARG_COUNT(MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER, \
-                                      __VA_ARGS__), \
-       (__VA_ARGS__))
-
-#  define MOZ_BEGIN_ENUM_CLASS(...) MOZ_BEGIN_NESTED_ENUM_CLASS(__VA_ARGS__)
-#  define MOZ_END_ENUM_CLASS(Name) \
-     MOZ_END_NESTED_ENUM_CLASS(Name) \
-     MOZ_FINISH_NESTED_ENUM_CLASS(Name)
-
-#endif /* __cplusplus */
-
-#endif /* mozilla_TypedEnum_h */
--- a/mfbt/TypedEnumBits.h
+++ b/mfbt/TypedEnumBits.h
@@ -6,21 +6,65 @@
 
 /*
  * MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS allows using a typed enum as bit flags.
  */
 
 #ifndef mozilla_TypedEnumBits_h
 #define mozilla_TypedEnumBits_h
 
+#include "mozilla/Attributes.h"
 #include "mozilla/IntegerTypeTraits.h"
-#include "mozilla/TypedEnumInternal.h"
 
 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
+ * be, yet user code wants to be able to write
+ *
+ *   if (myFlags & Flags::SOME_PARTICULAR_FLAG)              (1)
+ *
+ * There are different approaches to solving this. Most of them require
+ * adapting user code. For example, we could implement operator! and have
+ * the user write
+ *
+ *   if (!!(myFlags & Flags::SOME_PARTICULAR_FLAG))          (2)
+ *
+ * Or we could supply a IsNonZero() or Any() function returning whether
+ * an enum value is nonzero, and have the user write
+ *
+ *   if (Any(Flags & Flags::SOME_PARTICULAR_FLAG))           (3)
+ *
+ * But instead, we choose to preserve the original user syntax (1) as it
+ * is inherently more readable, and to ease porting existing code to typed
+ * enums. We achieve this by having operator& and other binary bitwise
+ * operators have as return type a class, CastableTypedEnumResult,
+ * that wraps a typed enum but adds bool convertibility.
+ */
+template<typename E>
+class CastableTypedEnumResult
+{
+private:
+  const E mValue;
+
+public:
+  explicit MOZ_CONSTEXPR CastableTypedEnumResult(E aValue)
+    : mValue(aValue)
+  {}
+
+  MOZ_CONSTEXPR operator E() const { return mValue; }
+
+  template<typename DestinationType>
+  MOZ_EXPLICIT_CONVERSION MOZ_CONSTEXPR
+  operator DestinationType() const { return DestinationType(mValue); }
+
+  MOZ_CONSTEXPR bool operator !() const { return !bool(mValue); }
+};
+
 #define MOZ_CASTABLETYPEDENUMRESULT_BINOP(Op, OtherType, ReturnType) \
 template<typename E> \
 MOZ_CONSTEXPR ReturnType \
 operator Op(const OtherType& aE, const CastableTypedEnumResult<E>& aR) \
 { \
   return ReturnType(aE Op OtherType(aR)); \
 } \
 template<typename E> \
@@ -64,42 +108,16 @@ operator Op(E& aR1, \
 MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(&=)
 MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(|=)
 MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(^=)
 
 #undef MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP
 
 #undef MOZ_CASTABLETYPEDENUMRESULT_BINOP
 
-#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
-
-#define MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(Op, ReturnType) \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(typename E::Enum aE, const CastableTypedEnumResult<E>& aR) \
-{ \
-  return ReturnType(aE Op E(aR)); \
-} \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(const CastableTypedEnumResult<E>& aR, typename E::Enum aE) \
-{ \
-  return ReturnType(E(aR) Op aE); \
-}
-
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(|, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(&, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(^, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(==, bool)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(!=, bool)
-
-#undef MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11
-
-#endif // not MOZ_HAVE_CXX11_STRONG_ENUMS
-
 namespace detail {
 template<typename E>
 struct UnsignedIntegerTypeForEnum
   : UnsignedStdintTypeForSize<sizeof(E)>
 {};
 }
 
 } // namespace mozilla
@@ -114,71 +132,25 @@ struct UnsignedIntegerTypeForEnum
    } \
  \
    inline Name& \
    operator Op##=(Name& a, Name b) \
    { \
      return a = a Op b; \
    }
 
-#define MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name) \
+/**
+ * MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS generates standard bitwise operators
+ * for the given enum type. Use this to enable using an enum type as bit-field.
+ */
+#define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
    MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, |) \
    MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, &) \
    MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, ^) \
    inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
    operator~(Name a) \
    { \
      typedef mozilla::CastableTypedEnumResult<Name> Result; \
      typedef mozilla::detail::UnsignedIntegerTypeForEnum<Name>::Type U; \
      return Result(Name(~(U(a)))); \
    }
 
-#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
-#  define MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, Op) \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator Op(Name a, Name::Enum b) \
-     { \
-       return a Op Name(b); \
-     } \
- \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator Op(Name::Enum a, Name b) \
-     { \
-       return Name(a) Op b; \
-     } \
- \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator Op(Name::Enum a, Name::Enum b) \
-     { \
-       return Name(a) Op Name(b); \
-     } \
- \
-     inline Name& \
-     operator Op##=(Name& a, Name::Enum b) \
-     { \
-       return a = a Op Name(b); \
-    }
-
-#  define MOZ_MAKE_ENUM_CLASS_OPS_EXTRA_NON_CXX11(Name) \
-     MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, |) \
-     MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, &) \
-     MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, ^) \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator~(Name::Enum a) \
-     { \
-       return ~(Name(a)); \
-     }
-#endif
-
-/**
- * MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS generates standard bitwise operators
- * for the given enum type. Use this to enable using an enum type as bit-field.
- */
-#ifdef MOZ_HAVE_CXX11_STRONG_ENUMS
-#  define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
-     MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name)
-#else
-#  define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
-     MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name) \
-     MOZ_MAKE_ENUM_CLASS_OPS_EXTRA_NON_CXX11(Name)
-#endif
-
 #endif // mozilla_TypedEnumBits_h
deleted file mode 100644
--- a/mfbt/TypedEnumInternal.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* Internal stuff needed by TypedEnum.h and TypedEnumBits.h. */
-
-// NOTE: When we can assume C++11 enum class support and TypedEnum.h goes away,
-// we should then consider folding TypedEnumInternal.h into TypedEnumBits.h.
-
-#ifndef mozilla_TypedEnumInternal_h
-#define mozilla_TypedEnumInternal_h
-
-#include "mozilla/Attributes.h"
-
-#if defined(__cplusplus)
-
-#if defined(__clang__)
-   /*
-    * 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_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_STRONG_ENUMS
-#    endif
-#  endif
-#elif defined(_MSC_VER)
-#  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
- * be, yet user code wants to be able to write
- *
- *   if (myFlags & Flags::SOME_PARTICULAR_FLAG)              (1)
- *
- * There are different approaches to solving this. Most of them require
- * adapting user code. For example, we could implement operator! and have
- * the user write
- *
- *   if (!!(myFlags & Flags::SOME_PARTICULAR_FLAG))          (2)
- *
- * Or we could supply a IsNonZero() or Any() function returning whether
- * an enum value is nonzero, and have the user write
- *
- *   if (Any(Flags & Flags::SOME_PARTICULAR_FLAG))           (3)
- *
- * But instead, we choose to preserve the original user syntax (1) as it
- * is inherently more readable, and to ease porting existing code to typed
- * enums. We achieve this by having operator& and other binary bitwise
- * operators have as return type a class, CastableTypedEnumResult,
- * that wraps a typed enum but adds bool convertibility.
- */
-template<typename E>
-class CastableTypedEnumResult
-{
-private:
-  const E mValue;
-
-public:
-  explicit MOZ_CONSTEXPR CastableTypedEnumResult(E aValue)
-    : mValue(aValue)
-  {}
-
-  MOZ_CONSTEXPR operator E() const { return mValue; }
-
-  template<typename DestinationType>
-  MOZ_EXPLICIT_CONVERSION MOZ_CONSTEXPR
-  operator DestinationType() const { return DestinationType(mValue); }
-
-  MOZ_CONSTEXPR bool operator !() const { return !bool(mValue); }
-
-#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
-  // This get() method is used to implement a constructor in the
-  // non-c++11 fallback path for MOZ_BEGIN_ENUM_CLASS, taking a
-  // CastableTypedEnumResult. If we try to implement it using the
-  // above conversion operator E(), then at least clang 3.3
-  // (when forced to take the non-c++11 fallback path) compiles
-  // this constructor to an infinite recursion. So we introduce this
-  // get() method, that does exactly the same as the conversion operator,
-  // to work around this.
-  MOZ_CONSTEXPR E get() const { return mValue; }
-#endif
-};
-
-} // namespace mozilla
-
-#endif // __cplusplus
-
-#endif // mozilla_TypedEnumInternal_h
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -64,19 +64,17 @@ EXPORTS.mozilla = [
     'SegmentedVector.h',
     'SHA1.h',
     'SizePrintfMacros.h',
     'SplayTree.h',
     'TaggedAnonymousMemory.h',
     'TemplateLib.h',
     'ThreadLocal.h',
     'ToString.h',
-    'TypedEnum.h',
     'TypedEnumBits.h',
-    'TypedEnumInternal.h',
     'Types.h',
     'TypeTraits.h',
     'UniquePtr.h',
     'Vector.h',
     'WeakPtr.h',
     'unused.h',
 ]
 
--- a/mfbt/tests/TestTypedEnum.cpp
+++ b/mfbt/tests/TestTypedEnum.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/TypedEnum.h"
 #include "mozilla/TypedEnumBits.h"
 
 #include <stdint.h>
 
 // A rough feature check for is_literal_type. Not very carefully checked.
 // Feel free to amend as needed.
 // We leave ANDROID out because it's using stlport which doesn't have std::is_literal_type.
 #if __cplusplus >= 201103L && !defined(ANDROID)
@@ -76,39 +75,39 @@ enum class AutoEnumBitField {
 enum class CharEnumBitField : char {
   A = 0x10,
   B,
   C = 0x40
 };
 
 struct Nested
 {
-  MOZ_BEGIN_NESTED_ENUM_CLASS(AutoEnum)
+  enum class AutoEnum {
     A,
     B,
     C = -1
-  MOZ_END_NESTED_ENUM_CLASS(AutoEnum)
+  };
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(CharEnum, char)
+  enum class CharEnum : char {
     A = 4,
     B,
     C = 1
-  MOZ_END_NESTED_ENUM_CLASS(CharEnum)
+  };
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(AutoEnumBitField)
+  enum class AutoEnumBitField {
     A,
     B = 0x20,
     C
-  MOZ_END_NESTED_ENUM_CLASS(AutoEnumBitField)
+  };
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(CharEnumBitField, char)
+  enum class CharEnumBitField : char {
     A = 1,
     B = 1,
     C = 1
-  MOZ_END_NESTED_ENUM_CLASS(CharEnumBitField)
+  };
 };
 
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AutoEnumBitField)
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CharEnumBitField)
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Nested::AutoEnumBitField)
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Nested::CharEnumBitField)
 
 #define MAKE_STANDARD_BITFIELD_FOR_TYPE(IntType)                   \
@@ -149,17 +148,17 @@ MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned
 #undef MAKE_STANDARD_BITFIELD_FOR_TYPE
 
 template<typename T>
 void
 TestNonConvertibilityForOneType()
 {
   using mozilla::IsConvertible;
 
-#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) && defined(MOZ_HAVE_EXPLICIT_CONVERSION)
+#if defined(MOZ_HAVE_EXPLICIT_CONVERSION)
   static_assert(!IsConvertible<T, bool>::value, "should not be convertible");
   static_assert(!IsConvertible<T, int>::value, "should not be convertible");
   static_assert(!IsConvertible<T, uint64_t>::value, "should not be convertible");
 #endif
 
   static_assert(!IsConvertible<bool, T>::value, "should not be convertible");
   static_assert(!IsConvertible<int, T>::value, "should not be convertible");
   static_assert(!IsConvertible<uint64_t, T>::value, "should not be convertible");
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -3,18 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_EventForwards_h__
 #define mozilla_EventForwards_h__
 
 #include <stdint.h>
 
-#include "mozilla/TypedEnum.h"
-
 /**
  * XXX Following enums should be in BasicEvents.h.  However, currently, it's
  *     impossible to use foward delearation for enum.
  */
 
 /**
  * Return status for event processors.
  */
--- a/widget/cocoa/VibrancyManager.h
+++ b/widget/cocoa/VibrancyManager.h
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef VibrancyManager_h
 #define VibrancyManager_h
 
 #include "mozilla/Assertions.h"
-#include "mozilla/TypedEnum.h"
 #include "nsClassHashtable.h"
 #include "nsRegion.h"
 #include "nsTArray.h"
 
 #import <Foundation/NSGeometry.h>
 
 @class NSColor;
 @class NSView;
--- a/xpcom/base/nsError.h
+++ b/xpcom/base/nsError.h
@@ -3,17 +3,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsError_h__
 #define nsError_h__
 
 #include "mozilla/Likely.h"
-#include "mozilla/TypedEnum.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
  *    right below this comment, adding 1.
@@ -117,38 +116,30 @@
  * doesn't really work for nsresult.  We need constants like NS_OK with type
  * nsresult, but they can't be used in (e.g.) switch cases if they're objects.
  * But if we define them to be of type nsresult::Enum instead, that causes
  *   return foo ? F() : NS_ERROR_FAILURE;
  * to fail, because nsresult and nsresult::Enum are two distinct types and
  * either can be converted to the other, so it's ambiguous.  So we have to fall
  * back to a regular enum.
  */
-#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
+#if defined(__cplusplus)
   typedef enum class tag_nsresult : uint32_t
   {
     #undef ERROR
     #define ERROR(key, val) key = val
     #include "ErrorList.h"
     #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(__cplusplus)
-  typedef enum tag_nsresult : uint32_t
-  {
-    #undef ERROR
-    #define ERROR(key, val) key = val
-    #include "ErrorList.h"
-    #undef ERROR
-  } nsresult;
 #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;
--- a/xpcom/glue/pldhash.h
+++ b/xpcom/glue/pldhash.h
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef pldhash_h___
 #define pldhash_h___
 /*
  * Double hashing, a la Knuth 6.
  */
+#include "mozilla/Attributes.h" // for MOZ_ALWAYS_INLINE
 #include "mozilla/fallible.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Types.h"
 #include "nscore.h"
 
 #ifdef PL_DHASHMETER
 #include <stdio.h>
 #endif