From: Jan Beulich <jbeulich@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] x86: parse_real_register() does not alter the parsed string
Date: Wed, 19 Apr 2023 09:43:58 +0000 (GMT) [thread overview]
Message-ID: <20230419094358.DCF9D3858D39@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=74e05e01e2de46dc817d747c646421125e59d6b1
commit 74e05e01e2de46dc817d747c646421125e59d6b1
Author: Jan Beulich <jbeulich@suse.com>
Date: Wed Apr 19 11:42:51 2023 +0200
x86: parse_real_register() does not alter the parsed string
Follow the model of strtol() et al - input string is const-qualified to
signal that the string isn't altered, but the returned "end" pointer is
not const-qualified, requiring const to be cast away (which generally is
a bad idea, but the alternative would be more convoluted code).
Diff:
---
gas/config/tc-i386.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index ea5705da4af..063c9705ddd 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -13750,9 +13750,9 @@ static bool check_register (const reg_entry *r)
/* REG_STRING starts *before* REGISTER_PREFIX. */
static const reg_entry *
-parse_real_register (char *reg_string, char **end_op)
+parse_real_register (const char *reg_string, char **end_op)
{
- char *s = reg_string;
+ const char *s = reg_string;
char *p;
char reg_name_given[MAX_REG_NAME_SIZE + 1];
const reg_entry *r;
@@ -13775,7 +13775,7 @@ parse_real_register (char *reg_string, char **end_op)
if (is_part_of_name (*s))
return (const reg_entry *) NULL;
- *end_op = s;
+ *end_op = (char *) s;
r = (const reg_entry *) str_hash_find (reg_hash, reg_name_given);
@@ -13803,7 +13803,7 @@ parse_real_register (char *reg_string, char **end_op)
++s;
if (*s == ')')
{
- *end_op = s + 1;
+ *end_op = (char *) s + 1;
know (r[fpr].reg_num == fpr);
return r + fpr;
}
reply other threads:[~2023-04-19 9:43 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=20230419094358.DCF9D3858D39@sourceware.org \
--to=jbeulich@sourceware.org \
--cc=bfd-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: 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).