beifg: Simplify the quite complicated way to divide a number by 2 in be_ifg_stat().
[libfirm] / ir / common / error.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief    Error handling for libFirm
9  * @author   Michael Beck
10  */
11 #ifndef FIRM_COMMON_ERROR_H
12 #define FIRM_COMMON_ERROR_H
13
14 /**
15  * @file
16  *
17  * Error handling for libFirm.
18  *
19  * @author Michael Beck
20  */
21
22 /* define a NORETURN attribute */
23 #ifndef NORETURN
24 # if defined(__GNUC__)
25 #  if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70)
26 #   define NORETURN void __attribute__ ((noreturn))
27 #  endif /* __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70) */
28 # endif /* defined(__GNUC__) */
29
30 # if defined(_MSC_VER)
31 #  define NORETURN void __declspec(noreturn)
32 # endif /* defined(_MSC_VER) */
33
34 /* If not set above, use "void" for DOES_NOT_RETURN. */
35 # ifndef NORETURN
36 # define NORETURN void
37 # endif /* ifndef NORETURN */
38 #endif /* ifndef NORETURN */
39
40 /**
41  * Prints a panic message to stderr and exits.
42  */
43 NORETURN panic(char const *file, int line, char const *func, char const *fmt, ...);
44
45 #define panic(...) panic(__FILE__, __LINE__, __func__, __VA_ARGS__)
46
47 # endif