summaryrefslogtreecommitdiffhomepage
path: root/ir/common/panic.c
blob: 8626a18002a86a2ab618abd59b0e9736bf981025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * This file is part of libFirm.
 * Copyright (C) 2012 University of Karlsruhe.
 */

/**
 * @file
 * @brief     Error handling for libFirm
 * @author    Michael Beck
 */
#include "panic.h"

#include "irprintf.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

FIRM_NORETURN print_panic(char const *const file, int const line,
                          char const *const func, char const *const fmt, ...)
{
	va_list ap;

	fprintf(stderr, "%s:%d: libFirm panic in %s: ", file, line, func);
	va_start(ap, fmt);
	ir_vfprintf(stderr, fmt, ap);
	va_end(ap);
	putc('\n', stderr);
	abort();
}