replaced old panic module by newer error handling module
[libfirm] / ir / common / error.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/common/error.h
4  * Purpose:     Error handling for libFirm
5  * Author:      Michael Beck
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (C) 1998-2006 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12 #ifndef _ERROR_H_
13 #define _ERROR_H_
14
15 /**
16  * @file error.h
17  *
18  * Error handling for libFirm.
19  *
20  * @author Michael Beck
21  */
22
23 /* define a NORETURN attribute */
24 #ifndef NORETURN
25 # if defined(__GNUC__)
26 #  if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70)
27 #   define NORETURN void __attribute__ ((noreturn))
28 #  endif /* __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 70) */
29 # endif /* defined(__GNUC__) */
30
31 # if defined(_MSC_VER)
32 #  define NORETURN void __declspec(noreturn)
33 # endif /* defined(_MSC_VER) */
34
35 /* If not set above, use "void" for DOES_NOT_RETURN. */
36 # ifndef NORETURN
37 # define NORETURN void
38 # endif /* ifndef NORETURN */
39 #endif /* ifndef NORETURN */
40
41 /**
42  * Prints a panic message to stderr and exits.
43  */
44 NORETURN panic(const char *fmt, ...);
45
46 # endif /*_ERROR_H_ */