[GAS/ARM] Clarify relation between reg_expected_msgs and arm_reg_type

Uses of reg_expected_msgs rely on each arm_reg_type enumerator to have a
message entry in the same order as the enumerator declaration. This is
not clearly stated in the definition of both the arm_reg_type enum and
the reg_expected_msgs. Worse, there is nothing to ensure both are kept
in sync.

As an attempt towards this, this patch uses C99 array designators to
ensure that each message is associated with the right arm_reg_type. A
comment is also added near the definition of arm_reg_type to point to
the reg_expected_msgs array. Finally, the array is synced with
arm_reg_type by adding the missing error message for REG_TYPE_RNB.

2017-11-22  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gas/
	* config/tc-arm.c (arm_reg_type): Comment on the link with
	reg_expected_msgs.
	(reg_expected_msgs): Initialize using array designators with
	arm_reg_type index.
This commit is contained in:
Thomas Preud'homme 2017-11-22 14:02:49 +00:00
parent 2400729ecf
commit 5aa75429d0
2 changed files with 33 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2017-11-22 Thomas Preud'homme <thomas.preudhomme@arm.com>
* config/tc-arm.c (arm_reg_type): Comment on the link with
reg_expected_msgs.
(reg_expected_msgs): Initialize using array designators with
arm_reg_type index.
2017-11-22 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gas/arc/hregs-err.s: New test.

View File

@ -571,7 +571,8 @@ struct neon_typed_alias
};
/* ARM register categories. This includes coprocessor numbers and various
architecture extensions' registers. */
architecture extensions' registers. Each entry should have an error message
in reg_expected_msgs below. */
enum arm_reg_type
{
REG_TYPE_RN,
@ -615,28 +616,30 @@ struct reg_entry
/* Diagnostics used when we don't get a register of the expected type. */
const char * const reg_expected_msgs[] =
{
N_("ARM register expected"),
N_("bad or missing co-processor number"),
N_("co-processor register expected"),
N_("FPA register expected"),
N_("VFP single precision register expected"),
N_("VFP/Neon double precision register expected"),
N_("Neon quad precision register expected"),
N_("VFP single or double precision register expected"),
N_("Neon double or quad precision register expected"),
N_("Neon single or double precision register expected"),
N_("VFP single, double or Neon quad precision register expected"),
N_("VFP system register expected"),
N_("Maverick MVF register expected"),
N_("Maverick MVD register expected"),
N_("Maverick MVFX register expected"),
N_("Maverick MVDX register expected"),
N_("Maverick MVAX register expected"),
N_("Maverick DSPSC register expected"),
N_("iWMMXt data register expected"),
N_("iWMMXt control register expected"),
N_("iWMMXt scalar register expected"),
N_("XScale accumulator register expected"),
[REG_TYPE_RN] = N_("ARM register expected"),
[REG_TYPE_CP] = N_("bad or missing co-processor number"),
[REG_TYPE_CN] = N_("co-processor register expected"),
[REG_TYPE_FN] = N_("FPA register expected"),
[REG_TYPE_VFS] = N_("VFP single precision register expected"),
[REG_TYPE_VFD] = N_("VFP/Neon double precision register expected"),
[REG_TYPE_NQ] = N_("Neon quad precision register expected"),
[REG_TYPE_VFSD] = N_("VFP single or double precision register expected"),
[REG_TYPE_NDQ] = N_("Neon double or quad precision register expected"),
[REG_TYPE_NSD] = N_("Neon single or double precision register expected"),
[REG_TYPE_NSDQ] = N_("VFP single, double or Neon quad precision register"
" expected"),
[REG_TYPE_VFC] = N_("VFP system register expected"),
[REG_TYPE_MVF] = N_("Maverick MVF register expected"),
[REG_TYPE_MVD] = N_("Maverick MVD register expected"),
[REG_TYPE_MVFX] = N_("Maverick MVFX register expected"),
[REG_TYPE_MVDX] = N_("Maverick MVDX register expected"),
[REG_TYPE_MVAX] = N_("Maverick MVAX register expected"),
[REG_TYPE_DSPSC] = N_("Maverick DSPSC register expected"),
[REG_TYPE_MMXWR] = N_("iWMMXt data register expected"),
[REG_TYPE_MMXWC] = N_("iWMMXt control register expected"),
[REG_TYPE_MMXWCG] = N_("iWMMXt scalar register expected"),
[REG_TYPE_XSCALE] = N_("XScale accumulator register expected"),
[REG_TYPE_RNB] = N_("")
};
/* Some well known registers that we refer to directly elsewhere. */