mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
Do not change type in get_discrete_low_bound
get_discrete_low_bound has this code: /* Set unsigned indicator if warranted. */ if (low >= 0) type->set_is_unsigned (true); It's bad to modify a type in a getter like this, so this patch removes this code. FWIW I looked and this code has been there since at least 1999 (it was in the initial sourceware import). Types in general would benefit from const-ification, which would probably reveal more code like this, but I haven't attempted that. Regression tested on x86-64 Fedora 36. Reviewed-by: Kevin Buettner <kevinb@redhat.com>
This commit is contained in:
@ -1084,10 +1084,6 @@ get_discrete_low_bound (struct type *type)
|
|||||||
low = type->field (i).loc_enumval ();
|
low = type->field (i).loc_enumval ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set unsigned indicator if warranted. */
|
|
||||||
if (low >= 0)
|
|
||||||
type->set_is_unsigned (true);
|
|
||||||
|
|
||||||
return low;
|
return low;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user