From: Frank Ch. Eigler Date: Wed, 13 Dec 2000 18:55:02 +0000 (+0000) Subject: * error message improvements for cgen assemblers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=606d55bcee33dd2d89bb5d36833839aac08c4690;p=binutils-gdb.git * error message improvements for cgen assemblers 2000-12-12 Frank Ch. Eigler * cgen-asm.in (@arch@_cgen_assemble_insn): Prefer printing insert-time error messages over later parse-time ones. --- diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index b84bcfdc028..8f36ad5f722 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2000-12-12 Frank Ch. Eigler + + * cgen-asm.in (@arch@_cgen_assemble_insn): Prefer printing insert-time + error messages over later parse-time ones. + 2000-12-12 Jim Wilson * ia64-dis.c (print_insn_ia64): Cast away const on ia64_free_opcode diff --git a/opcodes/cgen-asm.in b/opcodes/cgen-asm.in index 8abd8dea551..ad6d1722fab 100644 --- a/opcodes/cgen-asm.in +++ b/opcodes/cgen-asm.in @@ -200,7 +200,8 @@ const CGEN_INSN * { const char *start; CGEN_INSN_LIST *ilist; - const char *tmp_errmsg = NULL; + const char *parse_errmsg = NULL; + const char *insert_errmsg = NULL; /* Skip leading white space. */ while (isspace (* str)) @@ -235,14 +236,14 @@ const CGEN_INSN * /* Allow parse/insert handlers to obtain length of insn. */ CGEN_FIELDS_BITSIZE (fields) = CGEN_INSN_BITSIZE (insn); - tmp_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields); - if (tmp_errmsg != NULL) + parse_errmsg = CGEN_PARSE_FN (cd, insn) (cd, insn, & str, fields); + if (parse_errmsg != NULL) continue; /* ??? 0 is passed for `pc' */ - tmp_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, - (bfd_vma) 0); - if (tmp_errmsg != NULL) + insert_errmsg = CGEN_INSERT_FN (cd, insn) (cd, insn, fields, buf, + (bfd_vma) 0); + if (insert_errmsg != NULL) continue; /* It is up to the caller to actually output the insn and any @@ -250,15 +251,17 @@ const CGEN_INSN * return insn; } - /* Make sure we leave this with something at this point. */ - if (tmp_errmsg == NULL) - tmp_errmsg = "unknown mnemonic"; - { static char errbuf[150]; + const char *tmp_errmsg; #ifdef CGEN_VERBOSE_ASSEMBLER_ERRORS - /* if verbose error messages, use errmsg from CGEN_PARSE_FN */ + /* If requesting verbose error messages, use insert_errmsg. + Failing that, use parse_errmsg */ + tmp_errmsg = (insert_errmsg ? insert_errmsg : + parse_errmsg ? parse_errmsg : + _("unrecognized instruction")); + if (strlen (start) > 50) /* xgettext:c-format */ sprintf (errbuf, "%s `%.50s...'", tmp_errmsg, start);