m_warn_system_headers = false;
m_max_errors = 0;
m_internal_error = nullptr;
- m_text_callbacks.begin_diagnostic = default_diagnostic_starter;
- m_text_callbacks.start_span = default_diagnostic_start_span_fn;
- m_text_callbacks.end_diagnostic = default_diagnostic_finalizer;
+ m_text_callbacks.m_begin_diagnostic = default_diagnostic_starter;
+ m_text_callbacks.m_start_span = default_diagnostic_start_span_fn;
+ m_text_callbacks.m_end_diagnostic = default_diagnostic_finalizer;
m_option_enabled = nullptr;
m_option_state = nullptr;
m_option_name = nullptr;
class diagnostic_context
{
public:
+ /* Give access to m_text_callbacks. */
+ friend diagnostic_starter_fn &
+ diagnostic_starter (diagnostic_context *context);
+ friend diagnostic_start_span_fn &
+ diagnostic_start_span (diagnostic_context *context);
+ friend diagnostic_finalizer_fn &
+ diagnostic_finalizer (diagnostic_context *context);
+
typedef void (*ice_handler_callback_t) (diagnostic_context *);
typedef void (*set_locations_callback_t) (diagnostic_context *,
diagnostic_info *);
/* Maximum number of errors to report. */
int m_max_errors;
-public:
/* Client-supplied callbacks for use in text output. */
struct {
/* This function is called before any message is printed out. It is
from "/home/gdr/src/nifty_printer.h:56:
...
*/
- diagnostic_starter_fn begin_diagnostic;
+ diagnostic_starter_fn m_begin_diagnostic;
/* This function is called by diagnostic_show_locus in between
disjoint spans of source code, so that the context can print
something to indicate that a new span of source code has begun. */
- diagnostic_start_span_fn start_span;
+ diagnostic_start_span_fn m_start_span;
/* This function is called after the diagnostic message is printed. */
- diagnostic_finalizer_fn end_diagnostic;
+ diagnostic_finalizer_fn m_end_diagnostic;
} m_text_callbacks;
+public:
/* Client hook to report an internal error. */
void (*m_internal_error) (diagnostic_context *, const char *, va_list *);
/* Client supplied function to announce a diagnostic
(for text-based diagnostic output). */
-#define diagnostic_starter(DC) (DC)->m_text_callbacks.begin_diagnostic
+inline diagnostic_starter_fn &
+diagnostic_starter (diagnostic_context *context)
+{
+ return context->m_text_callbacks.m_begin_diagnostic;
+}
+
+/* Client supplied function called between disjoint spans of source code,
+ so that the context can print
+ something to indicate that a new span of source code has begun. */
+inline diagnostic_start_span_fn &
+diagnostic_start_span (diagnostic_context *context)
+{
+ return context->m_text_callbacks.m_start_span;
+}
/* Client supplied function called after a diagnostic message is
displayed (for text-based diagnostic output). */
-#define diagnostic_finalizer(DC) (DC)->m_text_callbacks.end_diagnostic
+inline diagnostic_finalizer_fn &
+diagnostic_finalizer (diagnostic_context *context)
+{
+ return context->m_text_callbacks.m_end_diagnostic;
+}
/* Extension hooks for client. */
#define diagnostic_context_auxiliary_data(DC) (DC)->m_client_aux_data