public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions
@ 2022-07-07  7:58 Tom de Vries
  2022-07-07  8:14 ` Enze Li
  2022-07-08 14:03 ` [committed][gdb/build] " Tom de Vries
  0 siblings, 2 replies; 5+ messages in thread
From: Tom de Vries @ 2022-07-07  7:58 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ludovic Courtès

Hi,

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=deprecated-declarations]
  680 |     scm_install_gmp_memory_functions = 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
...

The variable has been deprecated because it no longer has any effect.

Fix this by disabling the specific deprecation warning.

Also handle upcoming guile versions > 3.0, in which the variable will be
removed, by limiting the usage of the variable to guile versions <= 3.0.

This does not break anything.  The variable was merely used to address a
problem present in guile versions <= v3.0.5.

Note that we don't limit the usage of the variable to guile versions <= 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.

Tested on x86_64-linux.

Co-Authored-By: Tom de Vries <tdevries@suse.de>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28994

Any comments?

Thanks,
- Tom

[gdb/build] Handle deprecation of scm_install_gmp_memory_functions

---
 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_defn *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 after
+       version 3.0, so limit usage to 3.0 and before.  */
+#if SCM_MAJOR_VERSION < 3 || (SCM_MAJOR_VERSION == 3 && SCM_MINOR_VERSION == 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 = 0;
+#pragma GCC diagnostic pop
+#endif
 
     /* 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.,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions
  2022-07-07  7:58 [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions Tom de Vries
@ 2022-07-07  8:14 ` Enze Li
  2022-07-07  8:20   ` Tom de Vries
  2022-07-08 14:03 ` [committed][gdb/build] " Tom de Vries
  1 sibling, 1 reply; 5+ messages in thread
From: Enze Li @ 2022-07-07  8:14 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ludovic Courtès

Hi Tom,

Thanks for doing this. :)

On Thu, 2022-07-07 at 09:58 +0200, Tom de Vries via Gdb-patches wrote:
> Hi,
> 
> When building gdb with guile 3.0.8, we run into:
> ...
> gdb/guile/guile.c: In function \
>   'void gdbscm_initialize(const extension_language_defn*)':
> 

<...>

> 
> Tested on x86_64-linux.
> 
> Co-Authored-By: Tom de Vries <tdevries@suse.de>
^^^^^^^^^^^^^^
This part confused me.  Is it necessary to include such a line when the
author of the patch is the same person?

Thanks,
Enze

> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28994
> 
> Any comments?
> 
> Thanks,
> - Tom
> 
> [gdb/build] Handle deprecation of scm_install_gmp_memory_functions
> 
> ---
>  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_defn *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 after
> +       version 3.0, so limit usage to 3.0 and before.  */
> +#if SCM_MAJOR_VERSION < 3 || (SCM_MAJOR_VERSION == 3 &&
> SCM_MINOR_VERSION == 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 = 0;
> +#pragma GCC diagnostic pop
> +#endif
>  
>      /* 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.,


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions
  2022-07-07  8:14 ` Enze Li
@ 2022-07-07  8:20   ` Tom de Vries
  2022-07-07  8:30     ` Enze Li
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2022-07-07  8:20 UTC (permalink / raw)
  To: Enze Li, gdb-patches; +Cc: Ludovic Courtès


On 7/7/22 10:14, Enze Li wrote:
> Hi Tom,
> 
> Thanks for doing this. :)
> 

Np :)

> On Thu, 2022-07-07 at 09:58 +0200, Tom de Vries via Gdb-patches wrote:
>> Hi,
>>
>> When building gdb with guile 3.0.8, we run into:
>> ...
>> gdb/guile/guile.c: In function \
>>    'void gdbscm_initialize(const extension_language_defn*)':
>>
> 
> <...>
> 
>>
>> Tested on x86_64-linux.
>>
>> Co-Authored-By: Tom de Vries <tdevries@suse.de>
> ^^^^^^^^^^^^^^
> This part confused me.  Is it necessary to include such a line when the
> author of the patch is the same person?
> 

No, indeed it's not necessary in such a case.

However, that is not the case here, because I'm not the (main) author:
...
$ git show --pretty=fuller -s
commit b47665709cabeb064cd57e1bf21b95d92c68be4e (HEAD -> fix
-guile-build)
Author:     Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Jul 7 08:20:28 2022 +0200
Commit:     Tom de Vries <tdevries@suse.de>
CommitDate: Thu Jul 7 09:54:52 2022 +0200

     [gdb/build] Handle deprecation of scm_install_gmp_memory_functions
...

Thanks,
- Tom

> Thanks,
> Enze
> 
>>
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28994
>>
>> Any comments?
>>
>> Thanks,
>> - Tom
>>
>> [gdb/build] Handle deprecation of scm_install_gmp_memory_functions
>>
>> ---
>>   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_defn *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 after
>> +       version 3.0, so limit usage to 3.0 and before.  */
>> +#if SCM_MAJOR_VERSION < 3 || (SCM_MAJOR_VERSION == 3 &&
>> SCM_MINOR_VERSION == 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 = 0;
>> +#pragma GCC diagnostic pop
>> +#endif
>>   
>>       /* 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.,
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions
  2022-07-07  8:20   ` Tom de Vries
@ 2022-07-07  8:30     ` Enze Li
  0 siblings, 0 replies; 5+ messages in thread
From: Enze Li @ 2022-07-07  8:30 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches; +Cc: Ludovic Courtès

On Thu, 2022-07-07 at 10:20 +0200, Tom de Vries wrote:
> On 7/7/22 10:14, Enze Li wrote:
> > > 
> > > Co-Authored-By: Tom de Vries <tdevries@suse.de>
> > ^^^^^^^^^^^^^^
> > This part confused me.  Is it necessary to include such a line when
> > the
> > author of the patch is the same person?
> > 
> 
> No, indeed it's not necessary in such a case.
> 
> However, that is not the case here, because I'm not the (main)
> author:
> ...
> $ git show --pretty=fuller -s
> commit b47665709cabeb064cd57e1bf21b95d92c68be4e (HEAD -> fix
> -guile-build)
> Author:     Ludovic Courtès <ludo@gnu.org>
> AuthorDate: Thu Jul 7 08:20:28 2022 +0200
> Commit:     Tom de Vries <tdevries@suse.de>
> CommitDate: Thu Jul 7 09:54:52 2022 +0200
> 
>      [gdb/build] Handle deprecation of
> scm_install_gmp_memory_functions
> ...
> 

Thanks for your explanation.  I was just curious about this. :-)

Cheers!
Enze



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [committed][gdb/build] Handle deprecation of scm_install_gmp_memory_functions
  2022-07-07  7:58 [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions Tom de Vries
  2022-07-07  8:14 ` Enze Li
@ 2022-07-08 14:03 ` Tom de Vries
  1 sibling, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2022-07-08 14:03 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ludovic Courtès

On 7/7/22 09:58, Tom de Vries wrote:
> Hi,
> 
> 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=deprecated-declarations]
>    680 |     scm_install_gmp_memory_functions = 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
> ...
> 
> The variable has been deprecated because it no longer has any effect.
> 
> Fix this by disabling the specific deprecation warning.
> 
> Also handle upcoming guile versions > 3.0, in which the variable will be
> removed, by limiting the usage of the variable to guile versions <= 3.0.
> 
> This does not break anything.  The variable was merely used to address a
> problem present in guile versions <= v3.0.5.
> 
> Note that we don't limit the usage of the variable to guile versions <= 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.
> 
> Tested on x86_64-linux.
> 
> Co-Authored-By: Tom de Vries <tdevries@suse.de>
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28994
> 
> Any comments?
> 

Committed.

Thanks,
- Tom

> [gdb/build] Handle deprecation of scm_install_gmp_memory_functions
> 
> ---
>   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_defn *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 after
> +       version 3.0, so limit usage to 3.0 and before.  */
> +#if SCM_MAJOR_VERSION < 3 || (SCM_MAJOR_VERSION == 3 && SCM_MINOR_VERSION == 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 = 0;
> +#pragma GCC diagnostic pop
> +#endif
>   
>       /* 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.,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-08 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  7:58 [PATCH][gdb/build] Handle deprecation of scm_install_gmp_memory_functions Tom de Vries
2022-07-07  8:14 ` Enze Li
2022-07-07  8:20   ` Tom de Vries
2022-07-07  8:30     ` Enze Li
2022-07-08 14:03 ` [committed][gdb/build] " Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).