static /*@exits@*/ void handle_yasm_int_error(const char *file,
unsigned int line,
const char *message);
-static /*@exits@*/ void handle_yasm_fatal(const char *message, ...);
+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);
}
static /*@exits@*/ void
-handle_yasm_fatal(const char *fmt, ...)
+handle_yasm_fatal(const char *fmt, va_list va)
{
- va_list va;
fprintf(stderr, "yasm: %s: ", _("FATAL"));
- va_start(va, fmt);
vfprintf(stderr, gettext(fmt), va);
- va_end(va);
fputc('\n', stderr);
exit(EXIT_FAILURE);
}
/* Default handlers for replacable functions */
static /*@exits@*/ void def_internal_error_
(const char *file, unsigned int line, const char *message);
-static /*@exits@*/ void def_fatal(const char *message, ...);
+static /*@exits@*/ void def_fatal(const char *message, va_list va);
static const char *def_gettext_hook(const char *msgid);
/* Storage for errwarn's "extern" functions */
/*@exits@*/ void (*yasm_internal_error_)
(const char *file, unsigned int line, const char *message)
= def_internal_error_;
-/*@exits@*/ void (*yasm_fatal) (const char *message, ...) = def_fatal;
+/*@exits@*/ void (*yasm_fatal) (const char *message, va_list va) = def_fatal;
const char * (*yasm_gettext_hook) (const char *msgid) = def_gettext_hook;
/* Enabled warnings. See errwarn.h for a list. */
* memory), so just exit immediately.
*/
static void
-def_fatal(const char *fmt, ...)
+def_fatal(const char *fmt, va_list va)
{
- va_list va;
fprintf(stderr, "%s: ", yasm_gettext_hook(N_("FATAL")));
- va_start(va, fmt);
vfprintf(stderr, yasm_gettext_hook(fmt), va);
- va_end(va);
fputc('\n', stderr);
exit(EXIT_FAILURE);
}
print_warning(filename, line, we->msg);
}
}
+
+void
+yasm__fatal(const char *message, ...)
+{
+ va_list va;
+ va_start(va, message);
+ yasm_fatal(message, va);
+ /*@notreached@*/
+ va_end(va);
+}
* \warning This function must NOT return to calling code; exit or longjmp
* instead.
* \param message fatal error message
+ * \param va va_list argument list for message
+ */
+extern /*@exits@*/ void (*yasm_fatal) (const char *message, va_list va);
+
+/** Reporting point of fatal errors, with variable arguments (internal only).
+ * \warning This function calls #yasm_fatal, and thus does not return to the
+ * calling code.
+ * \param message fatal error message
* \param ... argument list for message
*/
-extern /*@exits@*/ void (*yasm_fatal) (const char *message, ...);
+/*@exits@*/ void yasm__fatal(const char *message, ...);
/** Log an error at a given line, displaying a different line. va_list version
* of yasm__error_at().
*/
#define YASM_LIB_INTERNAL
#include "util.h"
-RCSID("$IdPath: yasm/libyasm/xmalloc.c,v 1.13 2003/03/15 05:07:48 peter Exp $");
+RCSID("$IdPath$");
#include "coretype.h"
#include "errwarn.h"
size = 1;
newmem = malloc(size);
if (!newmem)
- yasm_fatal(N_("out of memory"));
+ yasm__fatal(N_("out of memory"));
return newmem;
}
newmem = calloc(nelem, elsize);
if (!newmem)
- yasm_fatal(N_("out of memory"));
+ yasm__fatal(N_("out of memory"));
return newmem;
}
else
newmem = realloc(oldmem, size);
if (!newmem)
- yasm_fatal(N_("out of memory"));
+ yasm__fatal(N_("out of memory"));
return newmem;
}
pos = ftell(info->f);
if (pos == -1) {
- yasm_fatal(N_("could not get file position on output file"));
+ yasm__fatal(N_("could not get file position on output file"));
/*@notreached@*/
return 1;
}
pos = ftell(info->f);
if (pos == -1) {
- yasm_fatal(N_("could not get file position on output file"));
+ yasm__fatal(N_("could not get file position on output file"));
/*@notreached@*/
return 1;
}
/* Allocate space for headers by seeking forward */
if (fseek(f, (long)(20+40*(coff_objfmt_parse_scnum-1)), SEEK_SET) < 0) {
- yasm_fatal(N_("could not seek on output file"));
+ yasm__fatal(N_("could not seek on output file"));
/*@notreached@*/
return;
}
}
pos = ftell(f);
if (pos == -1) {
- yasm_fatal(N_("could not get file position on output file"));
+ yasm__fatal(N_("could not get file position on output file"));
/*@notreached@*/
return;
}
/* Write headers */
if (fseek(f, 0, SEEK_SET) < 0) {
- yasm_fatal(N_("could not seek on output file"));
+ yasm__fatal(N_("could not seek on output file"));
/*@notreached@*/
return;
}
yasm__error_va(yasm_linemap_get_current(cur_lm), fmt, va);
break;
case ERR_FATAL:
- yasm_fatal(N_("unknown")); /* FIXME */
+ yasm_fatal(fmt, va);
+ /*@notreached@*/
break;
case ERR_PANIC:
yasm_internal_error(fmt); /* FIXME */
EXTRA_DIST += modules/preprocs/nasm/tests/nasmpp_test.sh
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.asm
EXTRA_DIST += modules/preprocs/nasm/tests/ifcritical-err.errwarn
+EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.asm
+EXTRA_DIST += modules/preprocs/nasm/tests/noinclude-err.errwarn
--- /dev/null
+%include "doesnotexist.inc"
--- /dev/null
+yasm: FATAL: unable to open include file `doesnotexist.inc'