aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-i386.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-06-07 12:03:32 +0200
committerJan Beulich <jbeulich@suse.com>2021-06-07 12:03:32 +0200
commit9d299bea8cca3bfd91a3c7a47510c52a9e829858 (patch)
tree69ea736234165bda8e0922c83669213a7dabbc36 /gas/config/tc-i386.c
parentc8d541e2e73493228f332f4bdc9ecc8164d3744f (diff)
downloadgdb-9d299bea8cca3bfd91a3c7a47510c52a9e829858.zip
gdb-9d299bea8cca3bfd91a3c7a47510c52a9e829858.tar.gz
gdb-9d299bea8cca3bfd91a3c7a47510c52a9e829858.tar.bz2
x86: make symbol quotation check consistent in i386_att_operand()
When d02603dc201f ("Allow symbol and label names to be enclosed in double quotes") added the check for a leading double quote to i386_att_operand(), it missed a second similar check after having found a segment override. To avoid the two checks going out of sync again, introduce an inline helper.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r--gas/config/tc-i386.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0fe439e..063383c 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -11368,6 +11368,14 @@ maybe_adjust_templates (void)
return 1;
}
+static INLINE bool starts_memory_operand (char c)
+{
+ return is_digit_char (c)
+ || is_identifier_char (c)
+ || c == '"'
+ || c == '(';
+}
+
/* Parse OPERAND_STRING into the i386_insn structure I. Returns zero
on error. */
@@ -11422,9 +11430,7 @@ i386_att_operand (char *operand_string)
i.jumpabsolute = true;
}
- if (!is_digit_char (*op_string)
- && !is_identifier_char (*op_string)
- && *op_string != '(')
+ if (!starts_memory_operand (*op_string))
{
as_bad (_("bad memory operand `%s'"), op_string);
return 0;
@@ -11474,10 +11480,7 @@ i386_att_operand (char *operand_string)
/* If it is a RC or SAE immediate, do nothing. */
;
}
- else if (is_digit_char (*op_string)
- || is_identifier_char (*op_string)
- || *op_string == '"'
- || *op_string == '(')
+ else if (starts_memory_operand (*op_string))
{
/* This is a memory reference of some sort. */
char *base_string;