[PATCH v2 31/65] MIPS: use is_whitespace()
Maciej W. Rozycki
macro@orcam.me.uk
Mon Feb 3 14:07:06 GMT 2025
On Mon, 27 Jan 2025, Jan Beulich wrote:
> --- a/gas/config/tc-mips.c
> +++ b/gas/config/tc-mips.c
> @@ -14388,7 +14388,7 @@ mips16_ip (char *str, struct mips_cl_ins
> struct mips_operand_token *tokens;
> unsigned int l;
>
> - for (s = str; *s != '\0' && *s != '.' && *s != ' '; ++s)
> + for (s = str; *s != '\0' && *s != '.' && !is_whitespace (*s); ++s)
^^^^^^^^^^
Shouldn't this also be `!is_end_of_stmt (*s)'?
> @@ -14399,8 +14399,9 @@ mips16_ip (char *str, struct mips_cl_ins
> case '\0':
> break;
>
> - case ' ':
> - s++;
> + default:
> + if (is_whitespace (*s))
> + s++;
> break;
Why `is_whitespace (*s)' rather than `is_whitespace (c)'?
I think this only causes obfuscation to this already messed up statement.
Since there are only two cases here really ('\0' does nothing and is the
only remaining possibility here, guaranteed by the loop right above) can
you please rewrite this as:
if (c == '.')
{
...
}
else if (is_whitespace (c))
s++;
or suchlike?
> @@ -14417,7 +14418,7 @@ mips16_ip (char *str, struct mips_cl_ins
> }
> if (*s == '\0')
And `is_end_of_stmt (*s)' here presumably too?
Otherwise OK, I think.
Maciej
More information about the Binutils
mailing list