#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "girmodule.h"
#include "girnode.h"
g_free (module);
}
+/**
+ * g_ir_module_fatal:
+ * @module: Current module
+ * @line: Origin line number, or 0 if unknown
+ * @msg: printf-format string
+ * @args: Remaining arguments
+ *
+ * Report a fatal error, then exit.
+ */
+void
+g_ir_module_fatal (GIrModule *module,
+ guint line,
+ const char *msg,
+ ...)
+{
+ char *formatted;
+
+ va_list args;
+
+ va_start (args, msg);
+
+ formatted = g_strdup_vprintf (msg, args);
+
+ if (line)
+ g_printerr ("%s-%s.gir:%d: error: %s\n", module->name, module->version, line, formatted);
+ else
+ g_printerr ("%s-%s.gir: error: %s\n", module->name, module->version, formatted);
+
+ exit (1);
+
+ va_end (args);
+}
+
static void
add_alias_foreach (gpointer key,
gpointer value,
GTypelib * g_ir_module_build_typelib (GIrModule *module,
GList *modules);
+void g_ir_module_fatal (GIrModule *module, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN;
+
void _g_irnode_init_stats (void);
void _g_irnode_dump_stats (void);
goto out;
}
- g_warning ("Entry '%s' not found", name);
+ g_ir_module_fatal (module, 0, "Type reference '%s' not found", name);
out:
if (!g_ir_find_node (module, modules, type->interface, &iface, &iface_module))
{
- g_warning ("Can't resolve type '%s' for %s", type->interface, who);
+ g_ir_module_fatal (module, 0, "Can't resolve type '%s' for %s", type->interface, who);
*size = -1;
*alignment = -1;
return FALSE;