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__);
36 * An error condition which is caused by and/or can be corrected by
39 * errorBelch() invokes (*errorMsgFn)().
41 extern void errorBelch(char *s, ...)
42 GNUC3_ATTRIBUTE(format (printf, 1, 2));
44 extern void verrorBelch(char *s, va_list ap);
47 * A debugging message. Debugging messages are generated either as a
48 * virtue of having DEBUG turned on, or by being explicitly selected
49 * via RTS options (eg. +RTS -Ds).
51 * debugBelch() invokes (*debugMsgFn)().
53 extern void debugBelch(char *s, ...)
54 GNUC3_ATTRIBUTE(format (printf, 1, 2));
56 extern void vdebugBelch(char *s, va_list ap);
59 /* Hooks for redirecting message generation: */
61 typedef void RtsMsgFunction(char *, va_list);
63 extern RtsMsgFunction *fatalInternalErrorFn;
64 extern RtsMsgFunction *debugMsgFn;
65 extern RtsMsgFunction *errorMsgFn;
67 /* Default stdio implementation of the message hooks: */
69 extern RtsMsgFunction rtsFatalInternalErrorFn;
70 extern RtsMsgFunction rtsDebugMsgFn;
71 extern RtsMsgFunction rtsErrorMsgFn;
73 #endif // RTSMESSAGES_H