* [binutils-gdb] x86: parse_real_register() does not alter the parsed string
@ 2023-04-19 9:43 Jan Beulich
0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-04-19 9:43 UTC (permalink / raw)
To: bfd-cvs
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-19 9:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 9:43 [binutils-gdb] x86: parse_real_register() does not alter the parsed string Jan Beulich
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).