Re: [PATCH v6 11/11] Add rvalue reference tests and NEWS entry

Keith Seitz
2017-03-17T17:06:38Z

Pedro asked me to resend/ping this since we'd like to have this for 8.0, and my last response had the patch oddly quoted. I apologize for that.

Keith

On 03/10/2017 02:02 PM, Eli Zaretskii wrote:
>> From: Keith Seitz <keiths@redhat.com>
>> Date: Fri, 10 Mar 2017 12:04:46 -0800
>>
>> diff --git a/gdb/NEWS b/gdb/NEWS
>> index cf58595..edbe41f 100644
>> --- a/gdb/NEWS
>> +++ b/gdb/NEWS
>> @@ -7,9 +7,12 @@
>> added by the Memory Protection Keys for Userspace feature which will be
>> available in future Intel CPUs.
>>
>> +* GDB now supports C++11 ravlue references.
> ^^^^^^
> A typo.

Good catch. Fixed.

> (I think it would be nice to have this described in the manual as
> well.)

I've searched through the manual for a suitable place to mention this,
the only bit of doc/gdb.texinfo that talks specifically about C++
references is the "reference declarations" in the C++ Expressions node.
I've added a bit explaining that GDB understands both lvalue and rvalue
references.

Let me know if you would like anything further, and thank you for the
quick review!

[I've trimmed down the patch to just the documentation parts. If you
would like to see the full patch, please see my reply to Pedro's message
on this patch.]

Keith

commit 25826f564b480af57a1da01c0f76c4b61034485e
Author: Artemiy Volkov <artemiyv@acm.org>
Date: Wed Jan 25 10:33:56 2017 -0800

Add rvalue reference tests and docs

This patch adds tests for the initial rvalue reference support patchset. All
of the new tests are practically mirrored regular references tests and, except
for the demangler ones, are introduced in new files, which are set to be
compiled with -std=gnu++11. Tested are printing of rvalue reference types and
values, rvalue reference parameters in function overloading, demangling of
function names containing rvalue reference parameters, casts to rvalue
reference types, application of the sizeof operator to rvalue reference types
and values, and support for rvalue references within the gdb python module.

gdb/ChnageLog

PR gdb/14441
* NEWS: Mention support for rvalue references in GDB and python.
* doc/gdb.texinfo (C Plus Plus Expressions): Mention that GDB
supports both lvalue and rvalue references.

[snip]
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 544f192..7876b47 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,13 @@
2017-MM-DD Artemiy Volkov <artemiyv@acm.org>

PR gdb/14441
+ * NEWS: Mention support for rvalue references in GDB and python.
+ * doc/gdb.texinfo (C Plus Plus Expressions): Mention that GDB
+ supports both lvalue and rvalue references.
+
+2017-MM-DD Artemiy Volkov <artemiyv@acm.org>
+
+ PR gdb/14441
* gdbtypes.c (rank_one_type): Implement overloading
resolution rules regarding rvalue references.

diff --git a/gdb/NEWS b/gdb/NEWS
index cf58595..4fade30 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -7,9 +7,12 @@
added by the Memory Protection Keys for Userspace feature which will be
available in future Intel CPUs.

+* GDB now supports C++11 rvalue references.
+
* Python Scripting

** New functions to start, stop and access a running btrace recording.
+ ** Rvalue references are now supported in gdb.Type.

* GDB now supports recording and replaying rdrand and rdseed Intel 64
instructions.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5cf0f97..581ddae 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14827,9 +14827,9 @@ see @ref{Completion, ,Command Completion}.

@cindex reference declarations
@item
-@value{GDBN} understands variables declared as C@t{++} references; you can use
-them in expressions just as you do in C@t{++} source---they are automatically
-dereferenced.
+@value{GDBN} understands variables declared as C@t{++} lvalue or rvalue
+references; you can use them in expressions just as you do in C@t{++}
+source---they are automatically dereferenced.