aboutsummaryrefslogtreecommitdiff
path: root/gdb/macroexp.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2024-02-03 14:32:06 -0700
committerTom Tromey <tom@tromey.com>2024-02-04 15:37:55 -0700
commitb36a26343a6c62b313d9e101b369155b6b799535 (patch)
treec5a73b5832f4ccbb914626230e2aeac11db0ab59 /gdb/macroexp.c
parent029e52bac7f3a6dd8b39f7f3d298b73174da806b (diff)
downloadgdb-b36a26343a6c62b313d9e101b369155b6b799535.zip
gdb-b36a26343a6c62b313d9e101b369155b6b799535.tar.gz
gdb-b36a26343a6c62b313d9e101b369155b6b799535.tar.bz2
Use reference result of emplace_back
Starting with C++17, emplace_back returns a reference to the new object. This patch changes code that uses emplace_back followed by a call to back() to simply use this reference instead. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/macroexp.c')
-rw-r--r--gdb/macroexp.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index 9523550..b8a9b29 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -789,12 +789,10 @@ gather_arguments (const char *name, shared_macro_buffer *src, int nargs,
for (;;)
{
- shared_macro_buffer *arg;
int depth;
/* Initialize the next argument. */
- args.emplace_back ();
- arg = &args.back ();
+ shared_macro_buffer *arg = &args.emplace_back ();
set_token (arg, src->text, src->text);
/* Gather the argument's tokens. */
@@ -819,8 +817,7 @@ gather_arguments (const char *name, shared_macro_buffer *src, int nargs,
missing. Add an empty argument in this case. */
if (nargs != -1 && args.size () == nargs - 1)
{
- args.emplace_back ();
- arg = &args.back ();
+ arg = &args.emplace_back ();
set_token (arg, src->text, src->text);
}