[v3,1/3] Guile: improved rvalue reference support

Message ID ws-_58dlja58hxs7_7nfxdpf-edz.sod4/tt56v&u48h70-.h_wk@mail.bob131.so
State Superseded
Headers show
Series
  • Guile: add value-{reference,const}-value
Related show

Commit Message

Lancelot SIX via Gdb-patches April 28, 2021, 4:27 p.m.
Adds a couple of missing bits to the Guile API to make C++11 rvalue
reference values and types usable from Guile scripts.

gdb/ChangeLog:

2021-04-29  George Barrett  <bob@bob131.so>

	* guile/scm-type.c (type_integer_constants): Add binding for
	TYPE_CODE_RVALUE_REF.
	* guile/scm-value.c (gdbscm_value_referenced_value): Handle
	dereferencing of rvalue references.
	* NEWS (Guile API): Note improvements in rvalue reference
	support.

gdb/doc/ChangeLog:

2021-04-29  George Barrett  <bob@bob131.so>

	* guile.texi (Types In Guile): Add documentation for
	TYPE_CODE_RVALUE_REF.
---
 gdb/NEWS              | 7 +++++++
 gdb/doc/guile.texi    | 3 +++
 gdb/guile/scm-type.c  | 1 +
 gdb/guile/scm-value.c | 1 +
 4 files changed, 12 insertions(+)

-- 
2.30.2

Comments

Lancelot SIX via Gdb-patches April 28, 2021, 4:38 p.m. | #1
> Date: Thu, 29 Apr 2021 02:27:26 +1000

> From: George Barrett via Gdb-patches <gdb-patches@sourceware.org>

> Cc: George Barrett <bob@bob131.so>

> 

> Adds a couple of missing bits to the Guile API to make C++11 rvalue

> reference values and types usable from Guile scripts.

> 

> gdb/ChangeLog:

> 

> 2021-04-29  George Barrett  <bob@bob131.so>

> 

> 	* guile/scm-type.c (type_integer_constants): Add binding for

> 	TYPE_CODE_RVALUE_REF.

> 	* guile/scm-value.c (gdbscm_value_referenced_value): Handle

> 	dereferencing of rvalue references.

> 	* NEWS (Guile API): Note improvements in rvalue reference

> 	support.

> 

> gdb/doc/ChangeLog:

> 

> 2021-04-29  George Barrett  <bob@bob131.so>

> 

> 	* guile.texi (Types In Guile): Add documentation for

> 	TYPE_CODE_RVALUE_REF.


The documentation parts are okay, thanks.
Andrew Burgess April 28, 2021, 4:54 p.m. | #2
* George Barrett via Gdb-patches <gdb-patches@sourceware.org> [2021-04-29 02:27:26 +1000]:

> Adds a couple of missing bits to the Guile API to make C++11 rvalue

> reference values and types usable from Guile scripts.

> 

> gdb/ChangeLog:

> 

> 2021-04-29  George Barrett  <bob@bob131.so>

> 

> 	* guile/scm-type.c (type_integer_constants): Add binding for

> 	TYPE_CODE_RVALUE_REF.

> 	* guile/scm-value.c (gdbscm_value_referenced_value): Handle

> 	dereferencing of rvalue references.

> 	* NEWS (Guile API): Note improvements in rvalue reference

> 	support.

> 

> gdb/doc/ChangeLog:

> 

> 2021-04-29  George Barrett  <bob@bob131.so>

> 

> 	* guile.texi (Types In Guile): Add documentation for

> 	TYPE_CODE_RVALUE_REF.


Looks good to me.

Thanks,
Andrew

> ---

>  gdb/NEWS              | 7 +++++++

>  gdb/doc/guile.texi    | 3 +++

>  gdb/guile/scm-type.c  | 1 +

>  gdb/guile/scm-value.c | 1 +

>  4 files changed, 12 insertions(+)

> 

> diff --git a/gdb/NEWS b/gdb/NEWS

> index 6550ea352ac..9c76df8b6d5 100644

> --- a/gdb/NEWS

> +++ b/gdb/NEWS

> @@ -185,6 +185,13 @@ QMemTags

>    Request the remote to store the specified allocation tags to the requested

>    memory range.

>  

> +* Guile API

> +

> +  ** Improved support for rvalue reference values:

> +     TYPE_CODE_RVALUE_REF is now exported as part of the API and the

> +     value-referenced-value procedure now handles rvalue reference

> +     values.

> +

>  *** Changes in GDB 10

>  

>  * There are new feature names for ARC targets: "org.gnu.gdb.arc.core"

> diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi

> index 762a82a08c5..c7904574002 100644

> --- a/gdb/doc/guile.texi

> +++ b/gdb/doc/guile.texi

> @@ -1268,6 +1268,9 @@ A pointer-to-member.

>  @item TYPE_CODE_REF

>  A reference type.

>  

> +@item TYPE_CODE_RVALUE_REF

> +A C@t{++}11 rvalue reference type.

> +

>  @item TYPE_CODE_CHAR

>  A character type.

>  

> diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c

> index 8d9c2c5f9a4..d65102b01c7 100644

> --- a/gdb/guile/scm-type.c

> +++ b/gdb/guile/scm-type.c

> @@ -1318,6 +1318,7 @@ static const scheme_integer_constant type_integer_constants[] =

>    X (TYPE_CODE_METHODPTR),

>    X (TYPE_CODE_MEMBERPTR),

>    X (TYPE_CODE_REF),

> +  X (TYPE_CODE_RVALUE_REF),

>    X (TYPE_CODE_CHAR),

>    X (TYPE_CODE_BOOL),

>    X (TYPE_CODE_COMPLEX),

> diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c

> index 59995169cd0..f50e8b5b46c 100644

> --- a/gdb/guile/scm-value.c

> +++ b/gdb/guile/scm-value.c

> @@ -476,6 +476,7 @@ gdbscm_value_referenced_value (SCM self)

>  	  res_val = value_ind (value);

>  	  break;

>  	case TYPE_CODE_REF:

> +	case TYPE_CODE_RVALUE_REF:

>  	  res_val = coerce_ref (value);

>  	  break;

>  	default:

> -- 

> 2.30.2

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index 6550ea352ac..9c76df8b6d5 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -185,6 +185,13 @@  QMemTags
   Request the remote to store the specified allocation tags to the requested
   memory range.
 
+* Guile API
+
+  ** Improved support for rvalue reference values:
+     TYPE_CODE_RVALUE_REF is now exported as part of the API and the
+     value-referenced-value procedure now handles rvalue reference
+     values.
+
 *** Changes in GDB 10
 
 * There are new feature names for ARC targets: "org.gnu.gdb.arc.core"
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 762a82a08c5..c7904574002 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -1268,6 +1268,9 @@  A pointer-to-member.
 @item TYPE_CODE_REF
 A reference type.
 
+@item TYPE_CODE_RVALUE_REF
+A C@t{++}11 rvalue reference type.
+
 @item TYPE_CODE_CHAR
 A character type.
 
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index 8d9c2c5f9a4..d65102b01c7 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -1318,6 +1318,7 @@  static const scheme_integer_constant type_integer_constants[] =
   X (TYPE_CODE_METHODPTR),
   X (TYPE_CODE_MEMBERPTR),
   X (TYPE_CODE_REF),
+  X (TYPE_CODE_RVALUE_REF),
   X (TYPE_CODE_CHAR),
   X (TYPE_CODE_BOOL),
   X (TYPE_CODE_COMPLEX),
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index 59995169cd0..f50e8b5b46c 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -476,6 +476,7 @@  gdbscm_value_referenced_value (SCM self)
 	  res_val = value_ind (value);
 	  break;
 	case TYPE_CODE_REF:
+	case TYPE_CODE_RVALUE_REF:
 	  res_val = coerce_ref (value);
 	  break;
 	default: