2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Error handling for libFirm
11 #ifndef FIRM_COMMON_ERROR_H
12 #define FIRM_COMMON_ERROR_H
17 * Error handling for libFirm.
19 * @author Michael Beck
22 /* define a NORETURN attribute */
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__) */
30 # if defined(_MSC_VER)
31 # define NORETURN void __declspec(noreturn)
32 # endif /* defined(_MSC_VER) */
34 /* If not set above, use "void" for DOES_NOT_RETURN. */
36 # define NORETURN void
37 # endif /* ifndef NORETURN */
38 #endif /* ifndef NORETURN */
41 * Prints a panic message to stderr and exits.
43 NORETURN panic(char const *file, int line, char const *func, char const *fmt, ...);
45 #define panic(...) panic(__FILE__, __LINE__, __func__, __VA_ARGS__)