1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-2004
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
10 * ---------------------------------------------------------------------------*/
17 /* -----------------------------------------------------------------------------
19 * -------------------------------------------------------------------------- */
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.
26 * barf() invokes (*fatalInternalErrorFn)(). This function is not
29 extern void barf(char *s, ...)
30 GNUC3_ATTRIBUTE(__noreturn__);
32 extern void vbarf(char *s, va_list ap)
33 GNUC3_ATTRIBUTE(__noreturn__);
35 extern void _assertFail(char *filename, unsigned int linenum)
36 GNUC3_ATTRIBUTE(__noreturn__);
39 * An error condition which is caused by and/or can be corrected by
42 * errorBelch() invokes (*errorMsgFn)().
44 extern void errorBelch(char *s, ...)
45 GNUC3_ATTRIBUTE(format (printf, 1, 2));
47 extern void verrorBelch(char *s, va_list ap);
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).
54 * debugBelch() invokes (*debugMsgFn)().
56 extern void debugBelch(char *s, ...)
57 GNUC3_ATTRIBUTE(format (printf, 1, 2));
59 extern void vdebugBelch(char *s, va_list ap);
62 /* Hooks for redirecting message generation: */
64 typedef void RtsMsgFunction(char *, va_list);
66 extern RtsMsgFunction *fatalInternalErrorFn;
67 extern RtsMsgFunction *debugMsgFn;
68 extern RtsMsgFunction *errorMsgFn;
70 /* Default stdio implementation of the message hooks: */
72 extern RtsMsgFunction rtsFatalInternalErrorFn;
73 extern RtsMsgFunction rtsDebugMsgFn;
74 extern RtsMsgFunction rtsErrorMsgFn;
76 #endif /* RTSMESSAGES_H */