Use enum bitfield for the calling_convention attribute of a subroutine

This is a refactoring.  Instead of a plain unsigned value, use an enum
bitfield.

gdb/ChangeLog:
2019-12-20  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* dwarf2read.c (is_valid_DW_AT_calling_convention_for_subroutine):
	New function.
	(read_subroutine_type): Validate the parsed
	DW_AT_calling_convention value before assigning it to a
	subroutine's calling_convention attribute.
	* gdbtypes.h (struct func_type) <calling_convention>: Use
	an enum bitfield as its type, instead of plain unsigned.

Change-Id: Ibc6b2f71e885cbc5c3c9d49734f7125acbfd1bcd
This commit is contained in:
Tankut Baris Aktemur 2019-12-20 18:23:32 +01:00
parent c855a9125a
commit d0922fcf02
3 changed files with 42 additions and 4 deletions

View file

@ -1157,9 +1157,9 @@ struct func_type
/* * The calling convention for targets supporting multiple ABIs.
Right now this is only fetched from the Dwarf-2
DW_AT_calling_convention attribute. The value is one of the
DW_CC enum dwarf_calling_convention constants. */
DW_CC constants. */
unsigned calling_convention : 8;
ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
/* * Whether this function normally returns to its caller. It is
set from the DW_AT_noreturn attribute if set on the