#include <libintl.h>
#define _(String) gettext (String)
+/* Build-time checks are preferrable over runtime ones. Use this construct
+ in preference where possible. */
+#define static_assert(e) ((void)sizeof (struct { int _:1 - 2 * !(e); }))
+
static const char *program_name = NULL;
static int debug = 0;
"FloatReg" },
{ "OPERAND_TYPE_FLOATACC",
"FloatAcc" },
- { "OPERAND_TYPE_SREG2",
- "SReg2" },
- { "OPERAND_TYPE_SREG3",
- "SReg3" },
+ { "OPERAND_TYPE_SREG",
+ "SReg" },
{ "OPERAND_TYPE_JUMPABSOLUTE",
"JumpAbsolute" },
{ "OPERAND_TYPE_REGMMX",
BITFIELD (No_ldSuf),
BITFIELD (FWait),
BITFIELD (IsString),
+ BITFIELD (RegMem),
BITFIELD (BNDPrefixOk),
BITFIELD (NoTrackPrefixOk),
BITFIELD (IsLockable),
BITFIELD (Control),
BITFIELD (Debug),
BITFIELD (Test),
- BITFIELD (SReg2),
- BITFIELD (SReg3),
+ BITFIELD (SReg),
BITFIELD (Acc),
BITFIELD (JumpAbsolute),
BITFIELD (EsSeg),
- BITFIELD (RegMem),
BITFIELD (Byte),
BITFIELD (Word),
BITFIELD (Dword),
/* Check the unused bitfield in i386_cpu_flags. */
#ifdef CpuUnused
+ static_assert (ARRAY_SIZE (cpu_flags) == CpuMax + 2);
+
if ((cpumax - 1) != CpuMax)
fail (_("CpuMax != %d!\n"), cpumax);
#else
+ static_assert (ARRAY_SIZE (cpu_flags) == CpuMax + 1);
+
if (cpumax != CpuMax)
fail (_("CpuMax != %d!\n"), cpumax);
fail (_("%d unused bits in i386_cpu_flags.\n"), c);
#endif
+ static_assert (ARRAY_SIZE (opcode_modifiers) == Opcode_Modifier_Num);
+
/* Check the unused bitfield in i386_operand_type. */
-#ifndef OTUnused
+#ifdef OTUnused
+ static_assert (ARRAY_SIZE (operand_types) == OTNum + 1);
+#else
+ static_assert (ARRAY_SIZE (operand_types) == OTNum);
+
c = OTNumOfBits - OTMax - 1;
if (c)
fail (_("%d unused bits in i386_operand_type.\n"), c);