static /*@exits@*/ void handle_yasm_fatal(const char *message, va_list va);
static const char *handle_yasm_gettext(const char *msgid);
static void print_yasm_error(const char *filename, unsigned long line,
- const char *msg, unsigned long xrefline,
- /*@null@*/ const char *xrefmsg);
+ const char *msg, /*@null@*/ const char *xref_fn,
+ unsigned long xref_line,
+ /*@null@*/ const char *xref_msg);
static void print_yasm_warning(const char *filename, unsigned long line,
const char *msg);
static void
print_yasm_error(const char *filename, unsigned long line, const char *msg,
- unsigned long xrefline, const char *xrefmsg)
+ const char *xref_fn, unsigned long xref_line,
+ const char *xref_msg)
{
if (line)
fprintf(stderr, fmt[ewmsg_style], filename, line, "", msg);
else
fprintf(stderr, fmt_noline[ewmsg_style], filename, "", msg);
- if (xrefmsg) {
- if (xrefline)
- fprintf(stderr, fmt[ewmsg_style], filename, xrefline, "", xrefmsg);
+ if (xref_fn && xref_msg) {
+ if (xref_line)
+ fprintf(stderr, fmt[ewmsg_style], xref_fn, xref_line, "", xref_msg);
else
- fprintf(stderr, fmt_noline[ewmsg_style], filename, "", xrefmsg);
+ fprintf(stderr, fmt_noline[ewmsg_style], xref_fn, "", xref_msg);
}
}
yasm_print_warning_func print_warning)
{
errwarn_data *we;
- const char *filename;
- unsigned long line;
+ const char *filename, *xref_filename;
+ unsigned long line, xref_line;
/* If we're treating warnings as errors, tell the user about it. */
if (warning_as_error && warning_as_error != 2) {
print_error("", 0,
yasm_gettext_hook(N_("warnings being treated as errors")),
- 0, NULL);
+ NULL, 0, NULL);
warning_as_error = 2;
}
SLIST_FOREACH(we, &errwarns->errwarns, link) {
/* Output error/warning */
yasm_linemap_lookup(lm, we->line, &filename, &line);
+ if (we->xrefline)
+ yasm_linemap_lookup(lm, we->xrefline, &xref_filename, &xref_line);
+ else {
+ xref_filename = NULL;
+ xref_line = 0;
+ }
if (we->type == WE_ERROR || we->type == WE_PARSERERROR)
- print_error(filename, line, we->msg, we->xrefline, we->xrefmsg);
+ print_error(filename, line, we->msg, xref_filename, xref_line,
+ we->xrefmsg);
else
print_warning(filename, line, we->msg);
}
int warning_as_error);
/** Print out an error.
- * \param fn filename of source file
- * \param line line number
- * \param msg error message
+ * \param fn filename of source file
+ * \param line line number
+ * \param msg error message
+ * \param xref_fn cross-referenced source filename
+ * \param xref_line cross-referenced line number
+ * \param xref_msg cross-referenced error message
*/
typedef void (*yasm_print_error_func)
(const char *fn, unsigned long line, const char *msg,
- unsigned long xrefline, /*@null@*/ const char *xrefmsg);
+ /*@null@*/ const char *xref_fn, unsigned long xref_line,
+ /*@null@*/ const char *xref_msg);
/** Print out a warning.
* \param fn filename of source file
-:5: warning: `pushfq' is an instruction in 64-bit mode
-:9: warning: `popfq' is an instruction in 64-bit mode
--:15: redefinition of `pushfq'
--:10: `pushfq' previously defined here
-:15: warning: `pushfq' is an instruction in 64-bit mode
--:19: redefinition of `popfq'
--:18: `popfq' previously defined here
+-:15: redefinition of `pushfq'
+-:5: `pushfq' previously defined here
-:19: warning: `popfq' is an instruction in 64-bit mode
+-:19: redefinition of `popfq'
+-:9: `popfq' previously defined here
-:24: `pushfd' invalid in 64-bit mode
-:28: `popfd' invalid in 64-bit mode
s->tok[TOKLEN] = savech;
}
}
+ /* Propagate errors in case we got a warning from the arch */
+ yasm_errwarn_propagate(parser_gas->errwarns, cur_line);
/* Just an identifier, return as such. */
lvalp->str_val = yasm__xstrndup(TOK, TOKLEN);
RETURN(ID);
default:
s->tok[TOKLEN] = savech;
}
+ /* Propagate errors in case we got a warning from the arch */
+ yasm_errwarn_propagate(parser_nasm->errwarns, cur_line);
/* Just an identifier, return as such. */
lvalp->str_val = yasm__xstrndup(TOK, TOKLEN);
RETURN(ID);