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(const char *s, ...)
30 GNUC3_ATTRIBUTE(__noreturn__);
32 extern void vbarf(const char *s, va_list ap)
33 GNUC3_ATTRIBUTE(__noreturn__);
35 extern void _assertFail(const 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(const char *s, ...)
45 GNUC3_ATTRIBUTE(format (printf, 1, 2));
47 extern void verrorBelch(const char *s, va_list ap);
50 * An error condition which is caused by and/or can be corrected by
51 * the user, and which has an associated error condition reported
52 * by the system (in errno on Unix, and GetLastError() on Windows).
53 * The system error message is appended to the message generated
54 * from the supplied format string.
56 * sysErrorBelch() invokes (*sysErrorMsgFn)().
58 extern void sysErrorBelch(const char *s, ...)
59 GNUC3_ATTRIBUTE(format (printf, 1, 2));
61 extern void vsysErrorBelch(const char *s, va_list ap);
64 * A debugging message. Debugging messages are generated either as a
65 * virtue of having DEBUG turned on, or by being explicitly selected
66 * via RTS options (eg. +RTS -Ds).
68 * debugBelch() invokes (*debugMsgFn)().
70 extern void debugBelch(const char *s, ...)
71 GNUC3_ATTRIBUTE(format (printf, 1, 2));
73 extern void vdebugBelch(const char *s, va_list ap);
76 /* Hooks for redirecting message generation: */
78 typedef void RtsMsgFunction(const char *, va_list);
80 extern RtsMsgFunction *fatalInternalErrorFn;
81 extern RtsMsgFunction *debugMsgFn;
82 extern RtsMsgFunction *errorMsgFn;
84 /* Default stdio implementation of the message hooks: */
86 extern RtsMsgFunction rtsFatalInternalErrorFn;
87 extern RtsMsgFunction rtsDebugMsgFn;
88 extern RtsMsgFunction rtsErrorMsgFn;
89 extern RtsMsgFunction rtsSysErrorMsgFn;
91 #endif /* RTSMESSAGES_H */