From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 26988385742B; Fri, 8 Jul 2022 14:01:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 26988385742B Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/build] Handle deprecation of scm_install_gmp_memory_functions X-Act-Checkin: binutils-gdb X-Git-Author: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Git-Refname: refs/heads/master X-Git-Oldrev: 8728fb3385c136b05dc16fb6664a57028acd0d73 X-Git-Newrev: 57f8fe908bec51c40ec686294460ec979b140843 Message-Id: <20220708140120.26988385742B@sourceware.org> Date: Fri, 8 Jul 2022 14:01:20 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2022 14:01:20 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D57f8fe908bec= 51c40ec686294460ec979b140843 commit 57f8fe908bec51c40ec686294460ec979b140843 Author: Ludovic Court=C3=A8s Date: Fri Jul 8 16:01:16 2022 +0200 [gdb/build] Handle deprecation of scm_install_gmp_memory_functions =20 When building gdb with guile 3.0.8, we run into: ... gdb/guile/guile.c: In function \ 'void gdbscm_initialize(const extension_language_defn*)': gdb/guile/guile.c:680:5: error: 'scm_install_gmp_memory_functions' is \ deprecated [-Werror=3Ddeprecated-declarations] 680 | scm_install_gmp_memory_functions =3D 0; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/guile/3.0/libguile.h:128, from gdb/guile/guile-internal.h:30, from gdb/guile/guile.c:36: /usr/include/guile/3.0/libguile/deprecated.h:164:20: note: declared here 164 | SCM_DEPRECATED int scm_install_gmp_memory_functions; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors make[1]: *** [Makefile:1896: guile/guile.o] Error 1 ... =20 The variable has been deprecated because it no longer has any effect. =20 Fix this by disabling the specific deprecation warning. =20 Also handle upcoming guile versions > 3.0, in which the variable will be removed, by limiting the usage of the variable to guile versions <=3D 3= .0. =20 This does not break anything. The variable was merely used to address a problem present in guile versions <=3D v3.0.5. =20 Note that we don't limit the usage of the variable to guile versions <= =3D 3.0.5, because we want to support f.i. building against 3.0.6 and then using a= shared lib with 3.0.5. =20 Tested on x86_64-linux. =20 Co-Authored-By: Tom de Vries =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28994 Diff: --- gdb/guile/guile.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 14b191ded62..e5565b627d9 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -677,7 +677,17 @@ gdbscm_initialize (const struct extension_language_def= n *extlang) "double free or corruption (out)" error. Work around the libguile bug by disabling the installation of the libgmp memory functions by guile initialization. */ + + /* The scm_install_gmp_memory_functions variable should be removed aft= er + version 3.0, so limit usage to 3.0 and before. */ +#if SCM_MAJOR_VERSION < 3 || (SCM_MAJOR_VERSION =3D=3D 3 && SCM_MINOR_VERS= ION =3D=3D 0) + /* This variable is deprecated in Guile 3.0.8 and later but remains + available in the whole 3.0 series. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" scm_install_gmp_memory_functions =3D 0; +#pragma GCC diagnostic pop +#endif =20 /* scm_with_guile is the most portable way to initialize Guile. Plus we need to initialize the Guile support while in Guile mode (e.g.,