remove empty dir
[ghc-hetmet.git] / ghc / includes / RtsMessages.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 1998-2004
4  *
5  * Message API for use inside the RTS.  All messages generated by the
6  * RTS should go through one of the functions declared here, and we
7  * also provide hooks so that messages from the RTS can be redirected
8  * as appropriate.
9  *
10  * ---------------------------------------------------------------------------*/
11
12 #ifndef RTSMESSAGES_H
13 #define RTSMESSAGES_H
14
15 #include <stdarg.h>
16
17 /* -----------------------------------------------------------------------------
18  * Message generation
19  * -------------------------------------------------------------------------- */
20
21 /*
22  * A fatal internal error: this is for errors that probably indicate
23  * bugs in the RTS or compiler.  We normally output bug reporting
24  * instructions along with the error message.
25  *
26  * barf() invokes (*fatalInternalErrorFn)().  This function is not
27  * expected to return.
28  */
29 extern void barf(char *s, ...)
30    GNUC3_ATTRIBUTE(__noreturn__);
31
32 extern void vbarf(char *s, va_list ap)
33    GNUC3_ATTRIBUTE(__noreturn__);
34
35 extern void _assertFail(char *filename, unsigned int linenum)
36    GNUC3_ATTRIBUTE(__noreturn__);
37
38 /*
39  * An error condition which is caused by and/or can be corrected by
40  * the user.
41  *
42  * errorBelch() invokes (*errorMsgFn)().
43  */
44 extern void errorBelch(char *s, ...)
45    GNUC3_ATTRIBUTE(format (printf, 1, 2));
46
47 extern void verrorBelch(char *s, va_list ap);
48
49 /*
50  * A debugging message.  Debugging messages are generated either as a
51  * virtue of having DEBUG turned on, or by being explicitly selected
52  * via RTS options (eg. +RTS -Ds).
53  *
54  * debugBelch() invokes (*debugMsgFn)().
55  */
56 extern void debugBelch(char *s, ...)
57    GNUC3_ATTRIBUTE(format (printf, 1, 2));
58
59 extern void vdebugBelch(char *s, va_list ap);
60
61
62 /* Hooks for redirecting message generation: */
63
64 typedef void RtsMsgFunction(char *, va_list);
65
66 extern RtsMsgFunction *fatalInternalErrorFn;
67 extern RtsMsgFunction *debugMsgFn;
68 extern RtsMsgFunction *errorMsgFn;
69
70 /* Default stdio implementation of the message hooks: */
71
72 extern RtsMsgFunction rtsFatalInternalErrorFn;
73 extern RtsMsgFunction rtsDebugMsgFn;
74 extern RtsMsgFunction rtsErrorMsgFn;
75
76 #endif /* RTSMESSAGES_H */