Bug 689609 - Don't enable c++11 on systems that don't really support it. r=ehsan,glandium.
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 28 Sep 2011 16:46:06 -0400
changeset 77784 4fce3a720570c20b03d354f4c1a57fb0d2d75948
parent 77783 ece3ae642585f0a0b7b9014880bf99ba50262293
child 77785 d8797563b04d4ee210d777437220b2f54dc0703f
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersehsan, glandium
bugs689609
milestone10.0a1
Bug 689609 - Don't enable c++11 on systems that don't really support it. r=ehsan,glandium.
configure.in
dom/plugins/base/android/ANPCanvas.cpp
--- a/configure.in
+++ b/configure.in
@@ -2819,34 +2819,38 @@ MOZ_ARG_ENABLE_BOOL(cpp-rtti,
 if test "$_MOZ_USE_RTTI"; then
    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
 else
    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
 fi
 
 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
 
-dnl Check whether we can use gcc's c++0x mode
+dnl Check whether we can use gcc's c++0x mode. We check for some basic
+dnl features that we need.
 AC_LANG_CPLUSPLUS
 
 if test "$GNU_CXX"; then
     _SAVE_CXXFLAGS=$CXXFLAGS
     CXXFLAGS="$CXXFLAGS -std=gnu++0x"
 
-    if test -z "$_MOZ_USE_RTTI"; then
-        CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
-        AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
-            ac_cv_cxx0x_headers_bug,
-            [AC_TRY_COMPILE([#include <memory>], [],
-                            ac_cv_cxx0x_headers_bug="no",
-                            ac_cv_cxx0x_headers_bug="yes")])
-        CXXFLAGS="$_SAVE_CXXFLAGS"
-        if test "$ac_cv_cxx0x_headers_bug" = "no"; then
-            CXXFLAGS="$CXXFLAGS -std=gnu++0x"
-        fi
+    CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
+    AC_CACHE_CHECK(for c++0x support,
+        ac_cv_cxx0x_support,
+        [AC_TRY_COMPILE([#include <memory>
+                         #include <utility>
+                         void f(int&&);], [
+                           int a;
+                           f(std::move(a));
+                        ],
+                        ac_cv_cxx0x_support="yes",
+                        ac_cv_cxx0x_support="no")])
+    CXXFLAGS="$_SAVE_CXXFLAGS"
+    if test "$ac_cv_cxx0x_support" = "yes"; then
+        CXXFLAGS="$CXXFLAGS -std=gnu++0x"
     fi
 fi
 
 dnl Check for usable char16_t (2 bytes, unsigned)
 dnl (we might not need the unsignedness check anymore)
 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
     ac_cv_have_usable_char16_t,
     [AC_TRY_COMPILE([$configure_static_assert_macros],
--- a/dom/plugins/base/android/ANPCanvas.cpp
+++ b/dom/plugins/base/android/ANPCanvas.cpp
@@ -52,21 +52,21 @@
 
 
 ANPCanvas*
 anp_canvas_newCanvas(const ANPBitmap* bitmap)
 {
   PRUint32 stride;
   gfxASurface::gfxImageFormat  format;
 
-  if (bitmap->format == ANPBitmapFormats::kRGBA_8888_ANPBitmapFormat) {
+  if (bitmap->format == kRGBA_8888_ANPBitmapFormat) {
     stride = bitmap->width * 4;
     format = gfxImageSurface::ImageFormatARGB32;
   }
-  else if (bitmap->format == ANPBitmapFormats::kRGB_565_ANPBitmapFormat) {
+  else if (bitmap->format == kRGB_565_ANPBitmapFormat) {
     stride = bitmap->width * 2;
     format = gfxImageSurface::ImageFormatRGB16_565;
   }
   else {
     LOG("%s -- Unknown format", __PRETTY_FUNCTION__);
     return nsnull;
   }