From patchwork Fri May 29 15:01:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 477946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3E020140E62 for ; Sat, 30 May 2015 01:03:21 +1000 (AEST) Received: from localhost ([::1]:36548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyLod-00057E-Da for incoming@patchwork.ozlabs.org; Fri, 29 May 2015 11:03:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyLnM-0001xs-7X for qemu-devel@nongnu.org; Fri, 29 May 2015 11:02:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyLnG-0003HM-2Z for qemu-devel@nongnu.org; Fri, 29 May 2015 11:02:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyLnF-0003HG-Sj for qemu-devel@nongnu.org; Fri, 29 May 2015 11:01:53 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 6CF93C12CC; Fri, 29 May 2015 15:01:53 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-116-107.ams2.redhat.com [10.36.116.107]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4TF1mUN024584; Fri, 29 May 2015 11:01:52 -0400 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Fri, 29 May 2015 16:01:48 +0100 Message-Id: <1432911708-22845-3-git-send-email-dgilbert@redhat.com> In-Reply-To: <1432911708-22845-1-git-send-email-dgilbert@redhat.com> References: <1432911708-22845-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, armbru@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 2/2] Compile time checks for newer glib X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Dr. David Alan Gilbert" Newer glib has support for checking that applications aren't using newer glib calls than they should be. The support for the check only went into glib 2.32 and it only has macros for version 2.26 upwards; although we only insist on 2.22 at the moment, I set the glib checks to the earliest of 2.26, it wont cause problems on anything <2.32 since the checks aren't there. While mainly we're interested in the check from GLIB_VERSION_MAX_ALLOWED which checks we're not using anything too recent, the glib macros require that if we set that then we must also define GLIB_VERSION_MIN_REQUIRED which checks we're not using anything deprecated too long ago. Signed-off-by: Dr. David Alan Gilbert --- configure | 5 +++++ include/glib-compat.h | 6 ++++++ tests/test-qdev-global-props.c | 2 +- tests/vhost-user-test.c | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 24ee0a4..5c6230a 100755 --- a/configure +++ b/configure @@ -2781,6 +2781,11 @@ fi glib_req_ver=2.22 glib_modules=gthread-2.0 +# Force warnings over use of newer glib features; 2.26 is the earliest +# version macro that is defined; eventually we should match +# glib_req_ver above +QEMU_CFLAGS="-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 $QEMU_CFLAGS" +QEMU_CFLAGS="-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_26 $QEMU_CFLAGS" if test "$modules" = yes; then glib_modules="$glib_modules gmodule-2.0" fi diff --git a/include/glib-compat.h b/include/glib-compat.h index 318e000..cbd660c 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -16,6 +16,12 @@ #ifndef QEMU_GLIB_COMPAT_H #define QEMU_GLIB_COMPAT_H +/* + * The source file including this compat header knows it's using newer glib + * functions than we generally allow, so don't warn about it. + */ +#undef GLIB_VERSION_MIN_REQUIRED +#undef GLIB_VERSION_MAX_ALLOWED #include /* GLIB version compatibility flags */ diff --git a/tests/test-qdev-global-props.c b/tests/test-qdev-global-props.c index 0be9835..896e6bf 100644 --- a/tests/test-qdev-global-props.c +++ b/tests/test-qdev-global-props.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include +#include "glib-compat.h" #include #include "hw/qdev.h" diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 75fedf0..7aeb927 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -8,6 +8,8 @@ * */ +#undef GLIB_VERSION_MIN_REQUIRED +#undef GLIB_VERSION_MAX_ALLOWED #define QEMU_GLIB_COMPAT_H #include