Bug 1080968 - Add support for constexpr and explicit conversions on clang-cl; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 10 Oct 2014 18:29:56 -0400
changeset 209966 d27ce1e75719e417328b570bec2c6dbcbd5e1de7
parent 209965 c32fd9b9c35576ad66b8365e9adb39cbe478ca78
child 209967 4ef90fdc2c5895c81cdf6434ce54a88dd7b3d499
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersfroydnj
bugs1080968
milestone35.0a1
Bug 1080968 - Add support for constexpr and explicit conversions on clang-cl; r=froydnj
mfbt/Attributes.h
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -60,16 +60,25 @@
 #      error Please do not try to use clang-cl with MSVC10 or below emulation!
 #    endif
      /* MSVC <= 10 used to spell "final" as "sealed". */
 #    define MOZ_HAVE_CXX11_FINAL         sealed
 #  endif
 #  define MOZ_HAVE_CXX11_OVERRIDE
 #  define MOZ_HAVE_NEVER_INLINE          __declspec(noinline)
 #  define MOZ_HAVE_NORETURN              __declspec(noreturn)
+#  ifdef __clang__
+     /* clang-cl probably supports constexpr and explicit conversions. */
+#    if __has_extension(cxx_constexpr)
+#      define MOZ_HAVE_CXX11_CONSTEXPR
+#    endif
+#    if __has_extension(cxx_explicit_conversions)
+#      define MOZ_HAVE_EXPLICIT_CONVERSION
+#    endif
+#  endif
 #elif 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 */