From: Jens Remus Date: Fri, 1 Mar 2024 11:45:14 +0000 (+0100) Subject: s390: Add comments to assembler operand parsing logic X-Git-Tag: gdb-15-branchpoint~815 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0af167da214b166dc2b7a17f688aa001687e999;p=thirdparty%2Fbinutils-gdb.git s390: Add comments to assembler operand parsing logic gas/ * config/tc-s390.c: Add comments to assembler operand parsing logic. Reviewed-by: Andreas Krebbel Signed-off-by: Jens Remus --- diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 55a5873edc1..9aebd8ca91e 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -1474,9 +1474,10 @@ md_gather_operands (char *str, /* After a displacement a block in parentheses can start. */ if (*str != '(') { - /* Check if parenthesized block can be skipped. If the next - operand is neither an optional operand nor a base register - then we have a syntax error. */ + /* There is no opening parentheses. Check if operands of + parenthesized block can be skipped. Only index and base + register operands as well as optional operands may be + skipped. A length operand may not be skipped. */ operand = s390_operands + *(++opindex_ptr); if (!(operand->flags & (S390_OPERAND_INDEX|S390_OPERAND_BASE))) as_bad (_("syntax error; missing '(' after displacement")); @@ -1485,6 +1486,8 @@ md_gather_operands (char *str, while (!(operand->flags & S390_OPERAND_BASE)) operand = s390_operands + *(++opindex_ptr); + /* If there is no further input and the remaining operands are + optional then have these optional operands processed. */ if (*str == '\0' && skip_optargs_p (opcode->flags, &opindex_ptr[1])) continue; @@ -1493,6 +1496,7 @@ md_gather_operands (char *str, { if (*str != ',') { + /* There is no comma. Skip all operands and stop. */ while (opindex_ptr[1] != '\0') { operand = s390_operands + *(++opindex_ptr); @@ -1501,7 +1505,10 @@ md_gather_operands (char *str, } } else - str++; + { + /* Comma. */ + str++; + } } } else @@ -1535,6 +1542,8 @@ md_gather_operands (char *str, str++; omitted_base_or_index = 0; + /* If there is no further input and the remaining operands are + optional then have these optional operands processed. */ if (*str == '\0' && skip_optargs_p (opcode->flags, &opindex_ptr[1])) continue; @@ -1543,6 +1552,7 @@ md_gather_operands (char *str, { if (*str != ',') { + /* There is no comma. Skip all operands and stop. */ while (opindex_ptr[1] != '\0') { operand = s390_operands + *(++opindex_ptr); @@ -1551,7 +1561,10 @@ md_gather_operands (char *str, } } else - str++; + { + /* Comma. */ + str++; + } } } else @@ -1567,6 +1580,8 @@ md_gather_operands (char *str, str++; } + /* If there is no further input and the remaining operands are + optional then have these optional operands processed. */ if (*str == '\0' && skip_optargs_p (opcode->flags, &opindex_ptr[1])) continue; @@ -1575,6 +1590,7 @@ md_gather_operands (char *str, { if (*str != ',') { + /* There is no comma. Skip all operands and stop. */ while (opindex_ptr[1] != '\0') { operand = s390_operands + *(++opindex_ptr); @@ -1583,7 +1599,10 @@ md_gather_operands (char *str, } } else - str++; + { + /* Comma. */ + str++; + } } } }