+2008-01-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-gen.c (lineno): New.
+ (filename): Likewise.
+ (set_bitfield): Report filename and line numer on error.
+ (process_i386_opcodes): Set filename and update lineno.
+ (process_i386_registers): Likewise.
+
2008-01-05 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (opcode_modifiers): Rename IntelMnemonic to
#endif
};
+static int lineno;
+static const char *filename;
+
static int
compare (const void *x, const void *y)
{
return;
}
- printf ("Unknown bitfield: %s\n", f);
+ printf ("%s: %d: Unknown bitfield: %s\n",
+ filename, lineno, f);
abort ();
}
static void
process_i386_opcodes (FILE *table)
{
- FILE *fp = fopen ("i386-opc.tbl", "r");
+ FILE *fp;
char buf[2048];
unsigned int i;
char *str, *p, *last;
char *opcode_length;
char *cpu_flags, *opcode_modifier, *operand_types [MAX_OPERANDS];
+ filename = "i386-opc.tbl";
+ fp = fopen (filename, "r");
+
if (fp == NULL)
fail (_("can't find i386-opc.tbl for reading, errno = %s\n"),
xstrerror (errno));
if (fgets (buf, sizeof (buf), fp) == NULL)
break;
+ lineno++;
+
p = remove_leading_whitespaces (buf);
/* Skip comments. */
static void
process_i386_registers (FILE *table)
{
- FILE *fp = fopen ("i386-reg.tbl", "r");
+ FILE *fp;
char buf[2048];
char *str, *p, *last;
char *reg_name, *reg_type, *reg_flags, *reg_num;
+ filename = "i386-reg.tbl";
+ fp = fopen (filename, "r");
if (fp == NULL)
fail (_("can't find i386-reg.tbl for reading, errno = %s\n"),
xstrerror (errno));
if (fgets (buf, sizeof (buf), fp) == NULL)
break;
+ lineno++;
+
p = remove_leading_whitespaces (buf);
/* Skip comments. */