Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 02/13] gdb: remove p_allocated_size parameter of gdb_cplus_demangle_print
Date: Tue, 20 Oct 2026 12:17:24 -0400	[thread overview]
Message-ID: <20261020162054.2140671-3-simon.marchi@efficios.com> (raw)
In-Reply-To: <20261020162054.2140671-1-simon.marchi@efficios.com>

The only caller of gdb_cplus_demangle_print, cp_comp_to_string, ignores
the allocated size it returns.  Remove the parameter.

Change-Id: I0efad01e56f1f3ee6df2c543574279a23cd66027
---
 gdb/cp-name-parser.c | 4 +---
 gdb/cp-support.c     | 7 ++++---
 gdb/cp-support.h     | 3 +--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/gdb/cp-name-parser.c b/gdb/cp-name-parser.c
index fe2ffd61a6c8..deb4ae4dd83b 100644
--- a/gdb/cp-name-parser.c
+++ b/gdb/cp-name-parser.c
@@ -380,10 +380,8 @@ cpname_state::parse_number (const char *p, int len, int parsed_float,
 gdb::unique_xmalloc_ptr<char>
 cp_comp_to_string (struct demangle_component *result, int estimated_len)
 {
-  size_t err;
-
   return gdb_cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result,
-				   estimated_len, &err);
+				   estimated_len);
 }
 
 /* Merge the two parse trees given by DEST and SRC.  The parse tree
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 0f1ead6a4e98..80f3f14c4086 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1641,12 +1641,13 @@ gdb_demangle (const char *name, int options)
 gdb::unique_xmalloc_ptr<char>
 gdb_cplus_demangle_print (int options,
 			  struct demangle_component *tree,
-			  int estimated_length,
-			  size_t *p_allocated_size)
+			  int estimated_length)
 {
+  size_t allocated_size;
+
   return gdb::unique_xmalloc_ptr<char>
     (cplus_demangle_print (options | DMGL_VERBOSE, tree,
-			   estimated_length, p_allocated_size));
+			   estimated_length, &allocated_size));
 }
 
 /* A wrapper for cplus_demangle_v3_components that forces
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 103cbf0cd652..4f5a12c8f69d 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -208,8 +208,7 @@ gdb::unique_xmalloc_ptr<char> gdb_demangle (const char *name, int options);
 /* A wrapper for cplus_demangle_print.  */
 
 extern gdb::unique_xmalloc_ptr<char> gdb_cplus_demangle_print
-  (int options, struct demangle_component *tree, int estimated_length,
-   size_t *p_allocated_size);
+  (int options, struct demangle_component *tree, int estimated_length);
 
 /* Find an instance of the character C in the string S that is outside
    of all parenthesis pairs, single-quoted strings, and double-quoted
-- 
2.56.0


  parent reply	other threads:[~2026-10-20 16:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 16:17 [PATCH 00/13] Make the C++ name parser recognize more char literal forms Simon Marchi
2026-10-20 16:17 ` [PATCH 01/13] gdb: make demangle_parse_info own the memory its tree points into Simon Marchi
2026-10-20 16:17 ` Simon Marchi [this message]
2026-10-20 16:17 ` [PATCH 03/13] gdb: modernize mangled_name_to_comp and cp_class_name_from_physname Simon Marchi
2026-10-20 16:17 ` [PATCH 04/13] gdb: fix crash in "maint canonicalize" without argument Simon Marchi
2026-10-20 16:17 ` [PATCH 05/13] gdb: move C++ name parser parsing selftest to its own test Simon Marchi
2026-10-20 16:17 ` [PATCH 06/13] gdb: check exact results in the canonicalize selftest Simon Marchi
2026-10-21 15:21   ` Tom Tromey
2026-10-21 15:48     ` Simon Marchi
2026-10-21 16:56       ` Tom Tromey
2026-10-21 17:01         ` Simon Marchi
2026-10-21 17:48           ` Tom Tromey
2026-10-22 16:28             ` Simon Marchi
2026-10-20 16:17 ` [PATCH 07/13] gdb: extract lex_char_literal from cpname_yylex Simon Marchi
2026-10-21 15:22   ` Tom Tromey
2026-10-20 16:17 ` [PATCH 08/13] gdb: remove \^ escape sequence support from C++ name parser Simon Marchi
2026-10-20 16:17 ` [PATCH 09/13] gdb: remove backslash-newline handling from cp_parse_escape Simon Marchi
2026-10-20 16:17 ` [PATCH 10/13] gdb: fix out-of-bounds reads in lex_char_literal Simon Marchi
2026-10-20 16:17 ` [PATCH 11/13] gdb: handle hexadecimal escapes in C++ name parser Simon Marchi
2026-10-20 16:17 ` [PATCH 12/13] gdb: handle character literal encoding prefixes " Simon Marchi
2026-10-20 16:17 ` [PATCH 13/13] gdb: handle universal character names " Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020162054.2140671-3-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox