[geany/geany] 409fe1: Try and avoid meaningless deprecation warnings from GLib and GTK

Colomban Wendling git-noreply at xxxxx
Wed Feb 24 21:06:14 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Wed, 24 Feb 2016 21:06:14 UTC
Commit:      409fe1a3234cf9e1fa74f81d1404fa3123e7c973
             https://github.com/geany/geany/commit/409fe1a3234cf9e1fa74f81d1404fa3123e7c973

Log Message:
-----------
Try and avoid meaningless deprecation warnings from GLib and GTK

Avoid deprecation warnings from GLib and GTK versions newer than what
we currently require by default.

To undo this and get all deprecation warnings back, undefine
`GLIB_VERSION_MIN_REQUIRED` and `GDK_DISABLE_DEPRECATION_WARNINGS` on
the command line (e.g. using `-U...` in `CFLAGS`).


Modified Paths:
--------------
    HACKING
    configure.ac

Modified: HACKING
14 lines changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -176,6 +176,20 @@ libs (including GLib, GDK and Pango) has the advantages
 that you don't get confused by any newer API additions and you 
 don't have to take care about whether you can use them or not.
 
+You might want to pass the ``-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28`` C
+preprocessor flag to get warnings about newer symbols from the GLib.
+
+On the contrary, you might also want to get deprecation warnings for symbols
+deprecated in newer versions, typically when preparing a dependency bump or
+trying to improve forward compatibility.
+To do so, use the ``-UGLIB_VERSION_MIN_REQUIRED`` flag for GLib deprecations,
+and ``-UGDK_DISABLE_DEPRECATION_WARNINGS`` for GTK and GDK ones.
+To change the lower deprecation bound for GLib (and then get warnings about
+symbols deprecated more recently) instead of simply removing it entirely, use
+``-UGLIB_VERSION_MIN_REQUIRED -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_X_YY``.
+
+See `Compiler options & warnings`_ for how to set such flags.
+
 Coding
 ------
 * Don't write long functions with a lot of variables and/or scopes - break


Modified: configure.ac
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -78,6 +78,13 @@ gtk_modules="$gtk_package >= $gtk_min_version glib-2.0 >= 2.28"
 gtk_modules_private="gio-2.0 >= 2.28 gmodule-no-export-2.0"
 PKG_CHECK_MODULES([GTK], [$gtk_modules $gtk_modules_private])
 AC_SUBST([DEPENDENCIES], [$gtk_modules])
+dnl Define minimum requirements to avoid warnings about symbols deprecated afterward.
+dnl Although GLIB_VERSION_2_28 is new in 2.32, older versions won't evaluate
+dnl GLIB_VERSION_MIN_REQUIRED so it won't be a problem.
+AS_VAR_APPEND([GTK_CFLAGS], [" -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"])
+dnl Disable all GTK deprecations on 3.x so long as we want to keep 2.x support and only require 3.0.
+dnl No need on 2.x as we target the latest version.
+AM_COND_IF([GTK3], [AS_VAR_APPEND([GTK_CFLAGS], [" -DGDK_DISABLE_DEPRECATION_WARNINGS"])])
 AC_SUBST([GTK_CFLAGS])
 AC_SUBST([GTK_LIBS])
 GTK_VERSION=`$PKG_CONFIG --modversion $gtk_package`



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list