public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Constify ada_main_name Date: Thu, 16 Feb 2023 15:12:32 +0000 (GMT) [thread overview] Message-ID: <20230216151232.61D50385B538@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6f63b61dd116becf96f47bb2dec61edd59f88a08 commit 6f63b61dd116becf96f47bb2dec61edd59f88a08 Author: Tom Tromey <tromey@adacore.com> Date: Thu Feb 16 08:10:59 2023 -0700 Constify ada_main_name Unlike the other *_main_name functions, ada_main_name returns a non-const "char *". This is strange, though, because the caller should not in fact modify or free this pointer. This patch changes this function to constify its return type. Diff: --- gdb/ada-lang.c | 4 ++-- gdb/ada-lang.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ec85729042f..b5afba30b4f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -805,8 +805,8 @@ ada_update_initial_language (enum language lang) The result is good until the next call. Return NULL if the main procedure doesn't appear to be in Ada. */ -char * -ada_main_name (void) +const char * +ada_main_name () { struct bound_minimal_symbol msym; static gdb::unique_xmalloc_ptr<char> main_program_name; diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h index f018b2465f5..339c151798e 100644 --- a/gdb/ada-lang.h +++ b/gdb/ada-lang.h @@ -337,7 +337,7 @@ extern enum ada_renaming_category ada_parse_renaming (struct symbol *, extern void ada_find_printable_frame (frame_info_ptr fi); -extern char *ada_main_name (void); +extern const char *ada_main_name (); extern void create_ada_exception_catchpoint (struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
reply other threads:[~2023-02-16 15:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230216151232.61D50385B538@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).