Improve handling of -fdph-* flags
[ghc.git] / 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(const char *s, ...)
30 GNUC3_ATTRIBUTE(__noreturn__);
31
32 extern void vbarf(const char *s, va_list ap)
33 GNUC3_ATTRIBUTE(__noreturn__);
34
35 extern void _assertFail(const 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(const char *s, ...)
45 GNUC3_ATTRIBUTE(format (printf, 1, 2));
46
47 extern void verrorBelch(const char *s, va_list ap);
48
49 /*
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.
55 *
56 * sysErrorBelch() invokes (*sysErrorMsgFn)().
57 */
58 extern void sysErrorBelch(const char *s, ...)
59 GNUC3_ATTRIBUTE(format (printf, 1, 2));
60
61 extern void vsysErrorBelch(const char *s, va_list ap);
62
63 /*
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).
67 *
68 * debugBelch() invokes (*debugMsgFn)().
69 */
70 extern void debugBelch(const char *s, ...)
71 GNUC3_ATTRIBUTE(format (printf, 1, 2));
72
73 extern void vdebugBelch(const char *s, va_list ap);
74
75
76 /* Hooks for redirecting message generation: */
77
78 typedef void RtsMsgFunction(const char *, va_list);
79
80 extern RtsMsgFunction *fatalInternalErrorFn;
81 extern RtsMsgFunction *debugMsgFn;
82 extern RtsMsgFunction *errorMsgFn;
83
84 /* Default stdio implementation of the message hooks: */
85
86 extern RtsMsgFunction rtsFatalInternalErrorFn;
87 extern RtsMsgFunction rtsDebugMsgFn;
88 extern RtsMsgFunction rtsErrorMsgFn;
89 extern RtsMsgFunction rtsSysErrorMsgFn;
90
91 #endif /* RTSMESSAGES_H */