forked from Imagelibrary/binutils-gdb
[ARC] Use FOR_EACH_DISASSEMBLER_OPTION to iterate over options
This patch updates arc-dis.c:parse_disassembler_options to use a macro FOR_EACH_DISASSEMBLER_OPTION, which has been introduced in [1], instead of a homegrown solution to split option string. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=65b48a81 opcodes/ChangeLog: yyyy-mm-dd Anton Kolesov <Anton.Kolesov@synopsys.com> * arc-dis.c (parse_disassembler_options): Use FOR_EACH_DISASSEMBLER_OPTION.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2017-06-29 Anton Kolesov <Anton.Kolesov@synopsys.com>
|
||||||
|
|
||||||
|
* arc-dis.c (parse_disassembler_options): Use
|
||||||
|
FOR_EACH_DISASSEMBLER_OPTION.
|
||||||
|
|
||||||
2017-06-29 Anton Kolesov <Anton.Kolesov@synopsys.com>
|
2017-06-29 Anton Kolesov <Anton.Kolesov@synopsys.com>
|
||||||
|
|
||||||
* arc-dis.c (parse_option): Use disassembler_options_cmp to compare
|
* arc-dis.c (parse_option): Use disassembler_options_cmp to compare
|
||||||
|
|||||||
@@ -823,6 +823,8 @@ parse_cpu_option (const char *option)
|
|||||||
static void
|
static void
|
||||||
parse_disassembler_options (const char *options)
|
parse_disassembler_options (const char *options)
|
||||||
{
|
{
|
||||||
|
const char *option;
|
||||||
|
|
||||||
if (options == NULL)
|
if (options == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -832,25 +834,15 @@ parse_disassembler_options (const char *options)
|
|||||||
CPU when new options are being parsed. */
|
CPU when new options are being parsed. */
|
||||||
enforced_isa_mask = ARC_OPCODE_NONE;
|
enforced_isa_mask = ARC_OPCODE_NONE;
|
||||||
|
|
||||||
while (*options)
|
FOR_EACH_DISASSEMBLER_OPTION (option, options)
|
||||||
{
|
{
|
||||||
/* Skip empty options. */
|
|
||||||
if (*options == ',')
|
|
||||||
{
|
|
||||||
++ options;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A CPU option? Cannot use STRING_COMMA_LEN because strncmp is also a
|
/* A CPU option? Cannot use STRING_COMMA_LEN because strncmp is also a
|
||||||
preprocessor macro. */
|
preprocessor macro. */
|
||||||
if (strncmp (options, "cpu=", 4) == 0)
|
if (strncmp (option, "cpu=", 4) == 0)
|
||||||
/* Strip leading `cpu=`. */
|
/* Strip leading `cpu=`. */
|
||||||
enforced_isa_mask = parse_cpu_option (options + 4);
|
enforced_isa_mask = parse_cpu_option (option + 4);
|
||||||
else
|
else
|
||||||
parse_option (options);
|
parse_option (option);
|
||||||
|
|
||||||
while (*options != ',' && *options != '\0')
|
|
||||||
++ options;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user