bug 1288702 suppress all GTK3 deprecated warnings r=glandium
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 27 Jul 2016 13:17:00 +1200
changeset 308620 513d42e7a166bab34785c7f727704bf8d32c1a36
parent 308619 e47457d354ec288f0fd54d2b44602d0e3c28bce3
child 308621 a854669c61035ad381f60c2b61dd935956abdcad
push id80391
push userkwierso@gmail.com
push dateMon, 08 Aug 2016 23:29:25 +0000
treeherdermozilla-inbound@5f01a72b5944 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1288702
milestone51.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 1288702 suppress all GTK3 deprecated warnings r=glandium Functions deprecated in GTK3 are often used for compatibility with GTK2 builds. MozReview-Commit-ID: F220phw3wVO
dom/ipc/ContentParent.cpp
old-configure.in
widget/gtk/compat-gtk3/gdk/gdkversionmacros.h
widget/gtk/moz.build
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1001,20 +1001,17 @@ ContentParent::RecvLoadPlugin(const uint
 
 bool
 ContentParent::RecvUngrabPointer(const uint32_t& aTime)
 {
 #if !defined(MOZ_WIDGET_GTK)
   NS_RUNTIMEABORT("This message only makes sense on GTK platforms");
   return false;
 #else
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
   gdk_pointer_ungrab(aTime);
-#pragma GCC diagnostic pop
   return true;
 #endif
 }
 
 bool
 ContentParent::RecvRemovePermission(const IPC::Principal& aPrincipal,
                                     const nsCString& aPermissionType,
                                     nsresult* aRv) {
--- a/old-configure.in
+++ b/old-configure.in
@@ -58,17 +58,17 @@ GLIB_VERSION=2.22
 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
 # The macro won't be used when compiling with earlier versions anyway.
 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
 GIO_VERSION=2.22
 CAIRO_VERSION=1.10
 PANGO_VERSION=1.22.0
 GTK2_VERSION=2.18.0
 GTK3_VERSION=3.4.0
-GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_4
+GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
 WINDRES_VERSION=2.14.90
 W32API_VERSION=3.14
 GNOMEUI_VERSION=2.2.0
 GCONF_VERSION=1.2.1
 STARTUP_NOTIFICATION_VERSION=0.8
 DBUS_VERSION=0.60
 SQLITE_VERSION=3.13.0
 FONTCONFIG_VERSION=2.7.0
@@ -2720,18 +2720,19 @@ gtk*)
 esac
 
 if test "$COMPILE_ENVIRONMENT"; then
   if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
     PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
     TK_CFLAGS=$MOZ_GTK3_CFLAGS
     TK_LIBS=$MOZ_GTK3_LIBS
-    AC_DEFINE_UNQUOTED(GDK_VERSION_MIN_REQUIRED,$GDK_VERSION_MIN_REQUIRED)
-    AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MIN_REQUIRED)
+    dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
+    dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
+    AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
     GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
   fi
   if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
     GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
   fi
   if test "$MOZ_ENABLE_GTK"; then
     if test "$MOZ_X11"; then
       GDK_PACKAGES=gdk-x11-2.0
new file mode 100644
--- /dev/null
+++ b/widget/gtk/compat-gtk3/gdk/gdkversionmacros.h
@@ -0,0 +1,31 @@
+#ifndef GDKVERSIONMACROS_WRAPPER_H
+#define GDKVERSIONMACROS_WRAPPER_H
+
+/**
+ * Suppress all GTK3 deprecated warnings as deprecated functions are often
+ * used for GTK2 compatibility.
+ *
+ * GDK_VERSION_MIN_REQUIRED cannot be used to suppress warnings for functions
+ * deprecated in 3.0, but still needs to be set because gdkversionmacros.h
+ * asserts that GDK_VERSION_MAX_ALLOWED >= GDK_VERSION_MIN_REQUIRED and
+ * GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_0.
+ *
+ * Setting GDK_DISABLE_DEPRECATION_WARNINGS would also disable
+ * GDK_UNAVAILABLE() warnings, which are useful.
+ */
+
+#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_0
+
+#include_next <gdk/gdkversionmacros.h>
+
+/* GDK_AVAILABLE_IN_ALL was introduced in 3.10 */
+#ifndef GDK_AVAILABLE_IN_ALL
+#define GDK_AVAILABLE_IN_ALL
+#endif
+
+#undef GDK_DEPRECATED
+#define GDK_DEPRECATED GDK_AVAILABLE_IN_ALL
+#undef GDK_DEPRECATED_FOR
+#define GDK_DEPRECATED_FOR(f) GDK_AVAILABLE_IN_ALL
+
+#endif /* GDKVERSIONMACROS_WRAPPER_H */
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -73,19 +73,16 @@ if CONFIG['ACCESSIBILITY']:
         'maiRedundantObjectFactory.c',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
     UNIFIED_SOURCES += [
         'gtk2drawing.c',
     ]
 else:
-    # Ignore GTK3 deprecation warnings while much of the code is still used
-    # with GTK2.
-    DEFINES['GDK_DISABLE_DEPRECATION_WARNINGS'] = True;
     UNIFIED_SOURCES += [
         'gtk3drawing.cpp',
         'nsApplicationChooser.cpp',
         'WidgetStyleCache.cpp',
     ]
 
 include('/ipc/chromium/chromium-config.mozbuild')