1 /* Language-independent diagnostic subroutines for the GNU Compiler Collection
2 Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
22 /* This file implements the language independent aspect of diagnostic
27 #include "coretypes.h"
31 #include "backtrace.h"
32 #include "diagnostic.h"
33 #include "diagnostic-color.h"
34 #include "edit-context.h"
41 #ifdef GWINSZ_IN_SYS_IOCTL
42 # include <sys/ioctl.h>
45 #define pedantic_warning_kind(DC) \
46 ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING)
47 #define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR)
48 #define permissive_error_option(DC) ((DC)->opt_permissive)
51 static bool diagnostic_impl (rich_location
*, int, const char *,
52 va_list *, diagnostic_t
) ATTRIBUTE_GCC_DIAG(3,0);
53 static bool diagnostic_n_impl (location_t
, int, int, const char *,
54 const char *, va_list *,
55 diagnostic_t
) ATTRIBUTE_GCC_DIAG(5,0);
56 static bool diagnostic_n_impl_richloc (rich_location
*, int, int, const char *,
57 const char *, va_list *,
58 diagnostic_t
) ATTRIBUTE_GCC_DIAG(5,0);
60 static void error_recursion (diagnostic_context
*) ATTRIBUTE_NORETURN
;
61 static void real_abort (void) ATTRIBUTE_NORETURN
;
63 /* Name of program invoked, sans directories. */
67 /* A diagnostic_context surrogate for stderr. */
68 static diagnostic_context global_diagnostic_context
;
69 diagnostic_context
*global_dc
= &global_diagnostic_context
;
71 /* Return a malloc'd string containing MSG formatted a la printf. The
72 caller is responsible for freeing the memory. */
74 build_message_string (const char *msg
, ...)
80 str
= xvasprintf (msg
, ap
);
86 /* Same as diagnostic_build_prefix, but only the source FILE is given. */
88 file_name_as_prefix (diagnostic_context
*context
, const char *f
)
91 = colorize_start (pp_show_color (context
->printer
), "locus");
92 const char *locus_ce
= colorize_stop (pp_show_color (context
->printer
));
93 return build_message_string ("%s%s:%s ", locus_cs
, f
, locus_ce
);
98 /* Return the value of the getenv("COLUMNS") as an integer. If the
99 value is not set to a positive integer, use ioctl to get the
100 terminal width. If it fails, return INT_MAX. */
102 get_terminal_width (void)
104 const char * s
= getenv ("COLUMNS");
114 if (ioctl (0, TIOCGWINSZ
, &w
) == 0 && w
.ws_col
> 0)
121 /* Set caret_max_width to value. */
123 diagnostic_set_caret_max_width (diagnostic_context
*context
, int value
)
125 /* One minus to account for the leading empty space. */
126 value
= value
? value
- 1
127 : (isatty (fileno (pp_buffer (context
->printer
)->stream
))
128 ? get_terminal_width () - 1: INT_MAX
);
133 context
->caret_max_width
= value
;
136 /* Initialize the diagnostic message outputting machinery. */
138 diagnostic_initialize (diagnostic_context
*context
, int n_opts
)
142 /* Allocate a basic pretty-printer. Clients will replace this a
143 much more elaborated pretty-printer if they wish. */
144 context
->printer
= XNEW (pretty_printer
);
145 new (context
->printer
) pretty_printer ();
147 memset (context
->diagnostic_count
, 0, sizeof context
->diagnostic_count
);
148 context
->warning_as_error_requested
= false;
149 context
->n_opts
= n_opts
;
150 context
->classify_diagnostic
= XNEWVEC (diagnostic_t
, n_opts
);
151 for (i
= 0; i
< n_opts
; i
++)
152 context
->classify_diagnostic
[i
] = DK_UNSPECIFIED
;
153 context
->show_caret
= false;
154 diagnostic_set_caret_max_width (context
, pp_line_cutoff (context
->printer
));
155 for (i
= 0; i
< rich_location::STATICALLY_ALLOCATED_RANGES
; i
++)
156 context
->caret_chars
[i
] = '^';
157 context
->show_option_requested
= false;
158 context
->abort_on_error
= false;
159 context
->show_column
= false;
160 context
->pedantic_errors
= false;
161 context
->permissive
= false;
162 context
->opt_permissive
= 0;
163 context
->fatal_errors
= false;
164 context
->dc_inhibit_warnings
= false;
165 context
->dc_warn_system_headers
= false;
166 context
->max_errors
= 0;
167 context
->internal_error
= NULL
;
168 diagnostic_starter (context
) = default_diagnostic_starter
;
169 context
->start_span
= default_diagnostic_start_span_fn
;
170 diagnostic_finalizer (context
) = default_diagnostic_finalizer
;
171 context
->option_enabled
= NULL
;
172 context
->option_state
= NULL
;
173 context
->option_name
= NULL
;
174 context
->last_location
= UNKNOWN_LOCATION
;
175 context
->last_module
= 0;
176 context
->x_data
= NULL
;
178 context
->inhibit_notes_p
= false;
179 context
->colorize_source_p
= false;
180 context
->show_ruler_p
= false;
181 context
->parseable_fixits_p
= false;
182 context
->edit_context_ptr
= NULL
;
185 /* Maybe initialize the color support. We require clients to do this
186 explicitly, since most clients don't want color. When called
187 without a VALUE, it initializes with DIAGNOSTICS_COLOR_DEFAULT. */
190 diagnostic_color_init (diagnostic_context
*context
, int value
/*= -1 */)
192 /* value == -1 is the default value. */
195 /* If DIAGNOSTICS_COLOR_DEFAULT is -1, default to
196 -fdiagnostics-color=auto if GCC_COLORS is in the environment,
197 otherwise default to -fdiagnostics-color=never, for other
198 values default to that
199 -fdiagnostics-color={never,auto,always}. */
200 if (DIAGNOSTICS_COLOR_DEFAULT
== -1)
202 if (!getenv ("GCC_COLORS"))
204 value
= DIAGNOSTICS_COLOR_AUTO
;
207 value
= DIAGNOSTICS_COLOR_DEFAULT
;
209 pp_show_color (context
->printer
)
210 = colorize_init ((diagnostic_color_rule_t
) value
);
213 /* Do any cleaning up required after the last diagnostic is emitted. */
216 diagnostic_finish (diagnostic_context
*context
)
218 /* Some of the errors may actually have been warnings. */
219 if (diagnostic_kind_count (context
, DK_WERROR
))
221 /* -Werror was given. */
222 if (context
->warning_as_error_requested
)
223 pp_verbatim (context
->printer
,
224 _("%s: all warnings being treated as errors"),
226 /* At least one -Werror= was given. */
228 pp_verbatim (context
->printer
,
229 _("%s: some warnings being treated as errors"),
231 pp_newline_and_flush (context
->printer
);
234 diagnostic_file_cache_fini ();
236 XDELETEVEC (context
->classify_diagnostic
);
237 context
->classify_diagnostic
= NULL
;
239 /* diagnostic_initialize allocates context->printer using XNEW
240 and placement-new. */
241 context
->printer
->~pretty_printer ();
242 XDELETE (context
->printer
);
243 context
->printer
= NULL
;
245 if (context
->edit_context_ptr
)
247 delete context
->edit_context_ptr
;
248 context
->edit_context_ptr
= NULL
;
252 /* Initialize DIAGNOSTIC, where the message MSG has already been
255 diagnostic_set_info_translated (diagnostic_info
*diagnostic
, const char *msg
,
256 va_list *args
, rich_location
*richloc
,
259 gcc_assert (richloc
);
260 diagnostic
->message
.err_no
= errno
;
261 diagnostic
->message
.args_ptr
= args
;
262 diagnostic
->message
.format_spec
= msg
;
263 diagnostic
->message
.m_richloc
= richloc
;
264 diagnostic
->richloc
= richloc
;
265 diagnostic
->kind
= kind
;
266 diagnostic
->option_index
= 0;
269 /* Initialize DIAGNOSTIC, where the message GMSGID has not yet been
272 diagnostic_set_info (diagnostic_info
*diagnostic
, const char *gmsgid
,
273 va_list *args
, rich_location
*richloc
,
276 gcc_assert (richloc
);
277 diagnostic_set_info_translated (diagnostic
, _(gmsgid
), args
, richloc
, kind
);
280 static const char *const diagnostic_kind_color
[] = {
281 #define DEFINE_DIAGNOSTIC_KIND(K, T, C) (C),
282 #include "diagnostic.def"
283 #undef DEFINE_DIAGNOSTIC_KIND
287 /* Get a color name for diagnostics of type KIND
288 Result could be NULL. */
291 diagnostic_get_color_for_kind (diagnostic_t kind
)
293 return diagnostic_kind_color
[kind
];
296 /* Return a malloc'd string describing a location e.g. "foo.c:42:10".
297 The caller is responsible for freeing the memory. */
300 diagnostic_get_location_text (diagnostic_context
*context
,
303 pretty_printer
*pp
= context
->printer
;
304 const char *locus_cs
= colorize_start (pp_show_color (pp
), "locus");
305 const char *locus_ce
= colorize_stop (pp_show_color (pp
));
308 return build_message_string ("%s%s:%s", locus_cs
, progname
, locus_ce
);
310 if (!strcmp (s
.file
, N_("<built-in>")))
311 return build_message_string ("%s%s:%s", locus_cs
, s
.file
, locus_ce
);
313 if (context
->show_column
)
314 return build_message_string ("%s%s:%d:%d:%s", locus_cs
, s
.file
, s
.line
,
317 return build_message_string ("%s%s:%d:%s", locus_cs
, s
.file
, s
.line
,
321 /* Return a malloc'd string describing a location and the severity of the
322 diagnostic, e.g. "foo.c:42:10: error: ". The caller is responsible for
323 freeing the memory. */
325 diagnostic_build_prefix (diagnostic_context
*context
,
326 const diagnostic_info
*diagnostic
)
328 static const char *const diagnostic_kind_text
[] = {
329 #define DEFINE_DIAGNOSTIC_KIND(K, T, C) (T),
330 #include "diagnostic.def"
331 #undef DEFINE_DIAGNOSTIC_KIND
334 gcc_assert (diagnostic
->kind
< DK_LAST_DIAGNOSTIC_KIND
);
336 const char *text
= _(diagnostic_kind_text
[diagnostic
->kind
]);
337 const char *text_cs
= "", *text_ce
= "";
338 pretty_printer
*pp
= context
->printer
;
340 if (diagnostic_kind_color
[diagnostic
->kind
])
342 text_cs
= colorize_start (pp_show_color (pp
),
343 diagnostic_kind_color
[diagnostic
->kind
]);
344 text_ce
= colorize_stop (pp_show_color (pp
));
347 expanded_location s
= diagnostic_expand_location (diagnostic
);
348 char *location_text
= diagnostic_get_location_text (context
, s
);
350 char *result
= build_message_string ("%s %s%s%s", location_text
,
351 text_cs
, text
, text_ce
);
352 free (location_text
);
356 /* Functions at which to stop the backtrace print. It's not
357 particularly helpful to print the callers of these functions. */
359 static const char * const bt_stop
[] =
367 /* A callback function passed to the backtrace_full function. */
370 bt_callback (void *data
, uintptr_t pc
, const char *filename
, int lineno
,
371 const char *function
)
373 int *pcount
= (int *) data
;
375 /* If we don't have any useful information, don't print
377 if (filename
== NULL
&& function
== NULL
)
380 /* Skip functions in diagnostic.c. */
383 && strcmp (lbasename (filename
), "diagnostic.c") == 0)
386 /* Print up to 20 functions. We could make this a --param, but
387 since this is only for debugging just use a constant for now. */
390 /* Returning a non-zero value stops the backtrace. */
396 if (function
!= NULL
)
398 char *str
= cplus_demangle_v3 (function
,
399 (DMGL_VERBOSE
| DMGL_ANSI
400 | DMGL_GNU_V3
| DMGL_PARAMS
));
407 for (size_t i
= 0; i
< ARRAY_SIZE (bt_stop
); ++i
)
409 size_t len
= strlen (bt_stop
[i
]);
410 if (strncmp (function
, bt_stop
[i
], len
) == 0
411 && (function
[len
] == '\0' || function
[len
] == '('))
415 /* Returning a non-zero value stops the backtrace. */
421 fprintf (stderr
, "0x%lx %s\n\t%s:%d\n",
423 function
== NULL
? "???" : function
,
424 filename
== NULL
? "???" : filename
,
433 /* A callback function passed to the backtrace_full function. This is
434 called if backtrace_full has an error. */
437 bt_err_callback (void *data ATTRIBUTE_UNUSED
, const char *msg
, int errnum
)
441 /* This means that no debug info was available. Just quietly
442 skip printing backtrace info. */
445 fprintf (stderr
, "%s%s%s\n", msg
, errnum
== 0 ? "" : ": ",
446 errnum
== 0 ? "" : xstrerror (errnum
));
449 /* Check if we've met the maximum error limit, and if so fatally exit
450 with a message. CONTEXT is the context to check, and FLUSH
451 indicates whether a diagnostic_finish call is needed. */
454 diagnostic_check_max_errors (diagnostic_context
*context
, bool flush
)
456 if (!context
->max_errors
)
459 int count
= (diagnostic_kind_count (context
, DK_ERROR
)
460 + diagnostic_kind_count (context
, DK_SORRY
)
461 + diagnostic_kind_count (context
, DK_WERROR
));
463 if (count
>= context
->max_errors
)
466 "compilation terminated due to -fmax-errors=%u.\n",
467 context
->max_errors
);
469 diagnostic_finish (context
);
470 exit (FATAL_EXIT_CODE
);
474 /* Take any action which is expected to happen after the diagnostic
475 is written out. This function does not always return. */
477 diagnostic_action_after_output (diagnostic_context
*context
,
478 diagnostic_t diag_kind
)
490 if (context
->abort_on_error
)
492 if (context
->fatal_errors
)
494 fnotice (stderr
, "compilation terminated due to -Wfatal-errors.\n");
495 diagnostic_finish (context
);
496 exit (FATAL_EXIT_CODE
);
503 struct backtrace_state
*state
= NULL
;
504 if (diag_kind
== DK_ICE
)
505 state
= backtrace_create_state (NULL
, 0, bt_err_callback
, NULL
);
508 backtrace_full (state
, 2, bt_callback
, bt_err_callback
,
511 if (context
->abort_on_error
)
514 fnotice (stderr
, "Please submit a full bug report,\n"
515 "with preprocessed source if appropriate.\n");
518 ("Please include the complete backtrace "
519 "with any bug report.\n"));
520 fnotice (stderr
, "See %s for instructions.\n", bug_report_url
);
522 exit (ICE_EXIT_CODE
);
526 if (context
->abort_on_error
)
528 diagnostic_finish (context
);
529 fnotice (stderr
, "compilation terminated.\n");
530 exit (FATAL_EXIT_CODE
);
538 diagnostic_report_current_module (diagnostic_context
*context
, location_t where
)
540 const line_map_ordinary
*map
= NULL
;
542 if (pp_needs_newline (context
->printer
))
544 pp_newline (context
->printer
);
545 pp_needs_newline (context
->printer
) = false;
548 if (where
<= BUILTINS_LOCATION
)
551 linemap_resolve_location (line_table
, where
,
552 LRK_MACRO_DEFINITION_LOCATION
,
555 if (map
&& diagnostic_last_module_changed (context
, map
))
557 diagnostic_set_last_module (context
, map
);
558 if (! MAIN_FILE_P (map
))
560 map
= INCLUDED_FROM (line_table
, map
);
561 if (context
->show_column
)
562 pp_verbatim (context
->printer
,
563 "In file included from %r%s:%d:%d%R", "locus",
565 LAST_SOURCE_LINE (map
), LAST_SOURCE_COLUMN (map
));
567 pp_verbatim (context
->printer
,
568 "In file included from %r%s:%d%R", "locus",
569 LINEMAP_FILE (map
), LAST_SOURCE_LINE (map
));
570 while (! MAIN_FILE_P (map
))
572 map
= INCLUDED_FROM (line_table
, map
);
573 pp_verbatim (context
->printer
,
574 ",\n from %r%s:%d%R", "locus",
575 LINEMAP_FILE (map
), LAST_SOURCE_LINE (map
));
577 pp_verbatim (context
->printer
, ":");
578 pp_newline (context
->printer
);
584 default_diagnostic_starter (diagnostic_context
*context
,
585 diagnostic_info
*diagnostic
)
587 diagnostic_report_current_module (context
, diagnostic_location (diagnostic
));
588 pp_set_prefix (context
->printer
, diagnostic_build_prefix (context
,
593 default_diagnostic_start_span_fn (diagnostic_context
*context
,
594 expanded_location exploc
)
596 pp_set_prefix (context
->printer
,
597 diagnostic_get_location_text (context
, exploc
));
598 pp_string (context
->printer
, "");
599 pp_newline (context
->printer
);
603 default_diagnostic_finalizer (diagnostic_context
*context
,
604 diagnostic_info
*diagnostic
)
606 diagnostic_show_locus (context
, diagnostic
->richloc
, diagnostic
->kind
);
607 pp_destroy_prefix (context
->printer
);
608 pp_flush (context
->printer
);
611 /* Interface to specify diagnostic kind overrides. Returns the
612 previous setting, or DK_UNSPECIFIED if the parameters are out of
613 range. If OPTION_INDEX is zero, the new setting is for all the
616 diagnostic_classify_diagnostic (diagnostic_context
*context
,
618 diagnostic_t new_kind
,
621 diagnostic_t old_kind
;
624 || option_index
>= context
->n_opts
625 || new_kind
>= DK_LAST_DIAGNOSTIC_KIND
)
626 return DK_UNSPECIFIED
;
628 old_kind
= context
->classify_diagnostic
[option_index
];
630 /* Handle pragmas separately, since we need to keep track of *where*
632 if (where
!= UNKNOWN_LOCATION
)
636 /* Record the command-line status, so we can reset it back on DK_POP. */
637 if (old_kind
== DK_UNSPECIFIED
)
639 old_kind
= !context
->option_enabled (option_index
,
640 context
->option_state
)
641 ? DK_IGNORED
: (context
->warning_as_error_requested
642 ? DK_ERROR
: DK_WARNING
);
643 context
->classify_diagnostic
[option_index
] = old_kind
;
646 for (i
= context
->n_classification_history
- 1; i
>= 0; i
--)
647 if (context
->classification_history
[i
].option
== option_index
)
649 old_kind
= context
->classification_history
[i
].kind
;
653 i
= context
->n_classification_history
;
654 context
->classification_history
=
655 (diagnostic_classification_change_t
*) xrealloc (context
->classification_history
, (i
+ 1)
656 * sizeof (diagnostic_classification_change_t
));
657 context
->classification_history
[i
].location
= where
;
658 context
->classification_history
[i
].option
= option_index
;
659 context
->classification_history
[i
].kind
= new_kind
;
660 context
->n_classification_history
++;
663 context
->classify_diagnostic
[option_index
] = new_kind
;
668 /* Save all diagnostic classifications in a stack. */
670 diagnostic_push_diagnostics (diagnostic_context
*context
, location_t where ATTRIBUTE_UNUSED
)
672 context
->push_list
= (int *) xrealloc (context
->push_list
, (context
->n_push
+ 1) * sizeof (int));
673 context
->push_list
[context
->n_push
++] = context
->n_classification_history
;
676 /* Restore the topmost classification set off the stack. If the stack
677 is empty, revert to the state based on command line parameters. */
679 diagnostic_pop_diagnostics (diagnostic_context
*context
, location_t where
)
685 jump_to
= context
->push_list
[-- context
->n_push
];
689 i
= context
->n_classification_history
;
690 context
->classification_history
=
691 (diagnostic_classification_change_t
*) xrealloc (context
->classification_history
, (i
+ 1)
692 * sizeof (diagnostic_classification_change_t
));
693 context
->classification_history
[i
].location
= where
;
694 context
->classification_history
[i
].option
= jump_to
;
695 context
->classification_history
[i
].kind
= DK_POP
;
696 context
->n_classification_history
++;
699 /* Helper function for print_parseable_fixits. Print TEXT to PP, obeying the
700 escaping rules for -fdiagnostics-parseable-fixits. */
703 print_escaped_string (pretty_printer
*pp
, const char *text
)
708 pp_character (pp
, '"');
709 for (const char *ch
= text
; *ch
; ch
++)
714 /* Escape backslash as two backslashes. */
715 pp_string (pp
, "\\\\");
718 /* Escape tab as "\t". */
719 pp_string (pp
, "\\t");
722 /* Escape newline as "\n". */
723 pp_string (pp
, "\\n");
726 /* Escape doublequotes as \". */
727 pp_string (pp
, "\\\"");
731 pp_character (pp
, *ch
);
733 /* Use octal for non-printable chars. */
735 unsigned char c
= (*ch
& 0xff);
736 pp_printf (pp
, "\\%o%o%o", (c
/ 64), (c
/ 8) & 007, c
& 007);
741 pp_character (pp
, '"');
744 /* Implementation of -fdiagnostics-parseable-fixits. Print a
745 machine-parseable version of all fixits in RICHLOC to PP. */
748 print_parseable_fixits (pretty_printer
*pp
, rich_location
*richloc
)
751 gcc_assert (richloc
);
753 for (unsigned i
= 0; i
< richloc
->get_num_fixit_hints (); i
++)
755 const fixit_hint
*hint
= richloc
->get_fixit_hint (i
);
756 source_location start_loc
= hint
->get_start_loc ();
757 expanded_location start_exploc
= expand_location (start_loc
);
758 pp_string (pp
, "fix-it:");
759 print_escaped_string (pp
, start_exploc
.file
);
760 source_location end_loc
;
762 /* For compatibility with clang, print as a half-open range. */
763 if (hint
->maybe_get_end_loc (&end_loc
))
765 expanded_location end_exploc
= expand_location (end_loc
);
766 pp_printf (pp
, ":{%i:%i-%i:%i}:",
767 start_exploc
.line
, start_exploc
.column
,
768 end_exploc
.line
, end_exploc
.column
+ 1);
772 pp_printf (pp
, ":{%i:%i-%i:%i}:",
773 start_exploc
.line
, start_exploc
.column
,
774 start_exploc
.line
, start_exploc
.column
);
776 switch (hint
->get_kind ())
778 case fixit_hint::INSERT
:
780 const fixit_insert
*insert
781 = static_cast <const fixit_insert
*> (hint
);
782 print_escaped_string (pp
, insert
->get_string ());
786 case fixit_hint::REPLACE
:
788 const fixit_replace
*replace
789 = static_cast <const fixit_replace
*> (hint
);
790 print_escaped_string (pp
, replace
->get_string ());
801 /* Report a diagnostic message (an error or a warning) as specified by
802 DC. This function is *the* subroutine in terms of which front-ends
803 should implement their specific diagnostic handling modules. The
804 front-end independent format specifiers are exactly those described
805 in the documentation of output_format.
806 Return true if a diagnostic was printed, false otherwise. */
809 diagnostic_report_diagnostic (diagnostic_context
*context
,
810 diagnostic_info
*diagnostic
)
812 location_t location
= diagnostic_location (diagnostic
);
813 diagnostic_t orig_diag_kind
= diagnostic
->kind
;
814 const char *saved_format_spec
;
816 /* Give preference to being able to inhibit warnings, before they
817 get reclassified to something else. */
818 if ((diagnostic
->kind
== DK_WARNING
|| diagnostic
->kind
== DK_PEDWARN
)
819 && !diagnostic_report_warnings_p (context
, location
))
822 if (diagnostic
->kind
== DK_PEDWARN
)
824 diagnostic
->kind
= pedantic_warning_kind (context
);
825 /* We do this to avoid giving the message for -pedantic-errors. */
826 orig_diag_kind
= diagnostic
->kind
;
829 if (diagnostic
->kind
== DK_NOTE
&& context
->inhibit_notes_p
)
832 if (context
->lock
> 0)
834 /* If we're reporting an ICE in the middle of some other error,
835 try to flush out the previous error, then let this one
836 through. Don't do this more than once. */
837 if ((diagnostic
->kind
== DK_ICE
|| diagnostic
->kind
== DK_ICE_NOBT
)
838 && context
->lock
== 1)
839 pp_newline_and_flush (context
->printer
);
841 error_recursion (context
);
844 /* If the user requested that warnings be treated as errors, so be
845 it. Note that we do this before the next block so that
846 individual warnings can be overridden back to warnings with
848 if (context
->warning_as_error_requested
849 && diagnostic
->kind
== DK_WARNING
)
850 diagnostic
->kind
= DK_ERROR
;
852 if (diagnostic
->option_index
853 && diagnostic
->option_index
!= permissive_error_option (context
))
855 diagnostic_t diag_class
= DK_UNSPECIFIED
;
857 /* This tests if the user provided the appropriate -Wfoo or
859 if (! context
->option_enabled (diagnostic
->option_index
,
860 context
->option_state
))
863 /* This tests for #pragma diagnostic changes. */
864 if (context
->n_classification_history
> 0)
866 /* FIXME: Stupid search. Optimize later. */
867 for (int i
= context
->n_classification_history
- 1; i
>= 0; i
--)
869 if (linemap_location_before_p
871 context
->classification_history
[i
].location
,
874 if (context
->classification_history
[i
].kind
== (int) DK_POP
)
876 i
= context
->classification_history
[i
].option
;
879 int option
= context
->classification_history
[i
].option
;
880 /* The option 0 is for all the diagnostics. */
881 if (option
== 0 || option
== diagnostic
->option_index
)
883 diag_class
= context
->classification_history
[i
].kind
;
884 if (diag_class
!= DK_UNSPECIFIED
)
885 diagnostic
->kind
= diag_class
;
892 /* This tests if the user provided the appropriate -Werror=foo
894 if (diag_class
== DK_UNSPECIFIED
895 && (context
->classify_diagnostic
[diagnostic
->option_index
]
898 = context
->classify_diagnostic
[diagnostic
->option_index
];
900 /* This allows for future extensions, like temporarily disabling
901 warnings for ranges of source code. */
902 if (diagnostic
->kind
== DK_IGNORED
)
906 if (diagnostic
->kind
!= DK_NOTE
)
907 diagnostic_check_max_errors (context
);
911 if (diagnostic
->kind
== DK_ICE
|| diagnostic
->kind
== DK_ICE_NOBT
)
913 /* When not checking, ICEs are converted to fatal errors when an
914 error has already occurred. This is counteracted by
917 && (diagnostic_kind_count (context
, DK_ERROR
) > 0
918 || diagnostic_kind_count (context
, DK_SORRY
) > 0)
919 && !context
->abort_on_error
)
922 = expand_location (diagnostic_location (diagnostic
));
923 fnotice (stderr
, "%s:%d: confused by earlier errors, bailing out\n",
925 exit (ICE_EXIT_CODE
);
927 if (context
->internal_error
)
928 (*context
->internal_error
) (context
,
929 diagnostic
->message
.format_spec
,
930 diagnostic
->message
.args_ptr
);
932 if (diagnostic
->kind
== DK_ERROR
&& orig_diag_kind
== DK_WARNING
)
933 ++diagnostic_kind_count (context
, DK_WERROR
);
935 ++diagnostic_kind_count (context
, diagnostic
->kind
);
937 saved_format_spec
= diagnostic
->message
.format_spec
;
938 if (context
->show_option_requested
)
942 option_text
= context
->option_name (context
, diagnostic
->option_index
,
943 orig_diag_kind
, diagnostic
->kind
);
948 = colorize_start (pp_show_color (context
->printer
),
949 diagnostic_kind_color
[diagnostic
->kind
]);
950 const char *ce
= colorize_stop (pp_show_color (context
->printer
));
951 diagnostic
->message
.format_spec
952 = ACONCAT ((diagnostic
->message
.format_spec
,
954 "[", cs
, option_text
, ce
, "]",
959 diagnostic
->message
.x_data
= &diagnostic
->x_data
;
960 diagnostic
->x_data
= NULL
;
961 pp_format (context
->printer
, &diagnostic
->message
);
962 (*diagnostic_starter (context
)) (context
, diagnostic
);
963 pp_output_formatted_text (context
->printer
);
964 (*diagnostic_finalizer (context
)) (context
, diagnostic
);
965 if (context
->parseable_fixits_p
)
967 print_parseable_fixits (context
->printer
, diagnostic
->richloc
);
968 pp_flush (context
->printer
);
970 diagnostic_action_after_output (context
, diagnostic
->kind
);
971 diagnostic
->message
.format_spec
= saved_format_spec
;
972 diagnostic
->x_data
= NULL
;
974 if (context
->edit_context_ptr
)
975 context
->edit_context_ptr
->add_fixits (diagnostic
->richloc
);
982 /* Given a partial pathname as input, return another pathname that
983 shares no directory elements with the pathname of __FILE__. This
984 is used by fancy_abort() to print `Internal compiler error in expr.c'
985 instead of `Internal compiler error in ../../GCC/gcc/expr.c'. */
988 trim_filename (const char *name
)
990 static const char this_file
[] = __FILE__
;
991 const char *p
= name
, *q
= this_file
;
993 /* First skip any "../" in each filename. This allows us to give a proper
994 reference to a file in a subdirectory. */
995 while (p
[0] == '.' && p
[1] == '.' && IS_DIR_SEPARATOR (p
[2]))
998 while (q
[0] == '.' && q
[1] == '.' && IS_DIR_SEPARATOR (q
[2]))
1001 /* Now skip any parts the two filenames have in common. */
1002 while (*p
== *q
&& *p
!= 0 && *q
!= 0)
1005 /* Now go backwards until the previous directory separator. */
1006 while (p
> name
&& !IS_DIR_SEPARATOR (p
[-1]))
1012 /* Standard error reporting routines in increasing order of severity.
1013 All of these take arguments like printf. */
1015 /* Text to be emitted verbatim to the error message stream; this
1016 produces no prefix and disables line-wrapping. Use rarely. */
1018 verbatim (const char *gmsgid
, ...)
1023 va_start (ap
, gmsgid
);
1024 text
.err_no
= errno
;
1025 text
.args_ptr
= &ap
;
1026 text
.format_spec
= _(gmsgid
);
1028 pp_format_verbatim (global_dc
->printer
, &text
);
1029 pp_newline_and_flush (global_dc
->printer
);
1033 /* Add a note with text GMSGID and with LOCATION to the diagnostic CONTEXT. */
1035 diagnostic_append_note (diagnostic_context
*context
,
1036 location_t location
,
1037 const char * gmsgid
, ...)
1039 diagnostic_info diagnostic
;
1041 const char *saved_prefix
;
1042 rich_location
richloc (line_table
, location
);
1044 va_start (ap
, gmsgid
);
1045 diagnostic_set_info (&diagnostic
, gmsgid
, &ap
, &richloc
, DK_NOTE
);
1046 if (context
->inhibit_notes_p
)
1051 saved_prefix
= pp_get_prefix (context
->printer
);
1052 pp_set_prefix (context
->printer
,
1053 diagnostic_build_prefix (context
, &diagnostic
));
1054 pp_format (context
->printer
, &diagnostic
.message
);
1055 pp_output_formatted_text (context
->printer
);
1056 pp_destroy_prefix (context
->printer
);
1057 pp_set_prefix (context
->printer
, saved_prefix
);
1058 diagnostic_show_locus (context
, &richloc
, DK_NOTE
);
1062 /* Implement emit_diagnostic, inform, inform_at_rich_loc, warning, warning_at,
1063 warning_at_rich_loc, pedwarn, permerror, permerror_at_rich_loc, error,
1064 error_at, error_at_rich_loc, sorry, fatal_error, internal_error, and
1065 internal_error_no_backtrace, as documented and defined below. */
1067 diagnostic_impl (rich_location
*richloc
, int opt
,
1069 va_list *ap
, diagnostic_t kind
)
1071 diagnostic_info diagnostic
;
1072 if (kind
== DK_PERMERROR
)
1074 diagnostic_set_info (&diagnostic
, gmsgid
, ap
, richloc
,
1075 permissive_error_kind (global_dc
));
1076 diagnostic
.option_index
= permissive_error_option (global_dc
);
1080 diagnostic_set_info (&diagnostic
, gmsgid
, ap
, richloc
, kind
);
1081 if (kind
== DK_WARNING
|| kind
== DK_PEDWARN
)
1082 diagnostic
.option_index
= opt
;
1084 return report_diagnostic (&diagnostic
);
1087 /* Same as diagonostic_n_impl taking rich_location instead of location_t. */
1089 diagnostic_n_impl_richloc (rich_location
*richloc
, int opt
, int n
,
1090 const char *singular_gmsgid
,
1091 const char *plural_gmsgid
,
1092 va_list *ap
, diagnostic_t kind
)
1094 diagnostic_info diagnostic
;
1095 diagnostic_set_info_translated (&diagnostic
,
1096 ngettext (singular_gmsgid
, plural_gmsgid
, n
),
1098 if (kind
== DK_WARNING
)
1099 diagnostic
.option_index
= opt
;
1100 return report_diagnostic (&diagnostic
);
1103 /* Implement inform_n, warning_n, and error_n, as documented and
1106 diagnostic_n_impl (location_t location
, int opt
, int n
,
1107 const char *singular_gmsgid
,
1108 const char *plural_gmsgid
,
1109 va_list *ap
, diagnostic_t kind
)
1111 rich_location
richloc (line_table
, location
);
1112 return diagnostic_n_impl_richloc (&richloc
, opt
, n
,
1113 singular_gmsgid
, plural_gmsgid
, ap
, kind
);
1117 emit_diagnostic (diagnostic_t kind
, location_t location
, int opt
,
1118 const char *gmsgid
, ...)
1121 va_start (ap
, gmsgid
);
1122 rich_location
richloc (line_table
, location
);
1123 bool ret
= diagnostic_impl (&richloc
, opt
, gmsgid
, &ap
, kind
);
1128 /* An informative note at LOCATION. Use this for additional details on an error
1131 inform (location_t location
, const char *gmsgid
, ...)
1134 va_start (ap
, gmsgid
);
1135 rich_location
richloc (line_table
, location
);
1136 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_NOTE
);
1140 /* Same as "inform", but at RICHLOC. */
1142 inform_at_rich_loc (rich_location
*richloc
, const char *gmsgid
, ...)
1145 va_start (ap
, gmsgid
);
1146 diagnostic_impl (richloc
, -1, gmsgid
, &ap
, DK_NOTE
);
1150 /* An informative note at LOCATION. Use this for additional details on an
1153 inform_n (location_t location
, int n
, const char *singular_gmsgid
,
1154 const char *plural_gmsgid
, ...)
1157 va_start (ap
, plural_gmsgid
);
1158 diagnostic_n_impl (location
, -1, n
, singular_gmsgid
, plural_gmsgid
,
1163 /* A warning at INPUT_LOCATION. Use this for code which is correct according
1164 to the relevant language specification but is likely to be buggy anyway.
1165 Returns true if the warning was printed, false if it was inhibited. */
1167 warning (int opt
, const char *gmsgid
, ...)
1170 va_start (ap
, gmsgid
);
1171 rich_location
richloc (line_table
, input_location
);
1172 bool ret
= diagnostic_impl (&richloc
, opt
, gmsgid
, &ap
, DK_WARNING
);
1177 /* A warning at LOCATION. Use this for code which is correct according to the
1178 relevant language specification but is likely to be buggy anyway.
1179 Returns true if the warning was printed, false if it was inhibited. */
1182 warning_at (location_t location
, int opt
, const char *gmsgid
, ...)
1185 va_start (ap
, gmsgid
);
1186 rich_location
richloc (line_table
, location
);
1187 bool ret
= diagnostic_impl (&richloc
, opt
, gmsgid
, &ap
, DK_WARNING
);
1192 /* Same as warning at, but using RICHLOC. */
1195 warning_at_rich_loc (rich_location
*richloc
, int opt
, const char *gmsgid
, ...)
1198 va_start (ap
, gmsgid
);
1199 bool ret
= diagnostic_impl (richloc
, opt
, gmsgid
, &ap
, DK_WARNING
);
1204 /* Same as warning_at_rich_loc but for plural variant. */
1207 warning_at_rich_loc_n (rich_location
*richloc
, int opt
, int n
,
1208 const char *singular_gmsgid
, const char *plural_gmsgid
, ...)
1211 va_start (ap
, plural_gmsgid
);
1212 bool ret
= diagnostic_n_impl_richloc (richloc
, opt
, n
,
1213 singular_gmsgid
, plural_gmsgid
,
1219 /* A warning at LOCATION. Use this for code which is correct according to the
1220 relevant language specification but is likely to be buggy anyway.
1221 Returns true if the warning was printed, false if it was inhibited. */
1224 warning_n (location_t location
, int opt
, int n
, const char *singular_gmsgid
,
1225 const char *plural_gmsgid
, ...)
1228 va_start (ap
, plural_gmsgid
);
1229 bool ret
= diagnostic_n_impl (location
, opt
, n
,
1230 singular_gmsgid
, plural_gmsgid
,
1236 /* A "pedantic" warning at LOCATION: issues a warning unless
1237 -pedantic-errors was given on the command line, in which case it
1238 issues an error. Use this for diagnostics required by the relevant
1239 language standard, if you have chosen not to make them errors.
1241 Note that these diagnostics are issued independent of the setting
1242 of the -Wpedantic command-line switch. To get a warning enabled
1243 only with that switch, use either "if (pedantic) pedwarn
1244 (OPT_Wpedantic,...)" or just "pedwarn (OPT_Wpedantic,..)". To get a
1245 pedwarn independently of the -Wpedantic switch use "pedwarn (0,...)".
1247 Returns true if the warning was printed, false if it was inhibited. */
1250 pedwarn (location_t location
, int opt
, const char *gmsgid
, ...)
1253 va_start (ap
, gmsgid
);
1254 rich_location
richloc (line_table
, location
);
1255 bool ret
= diagnostic_impl (&richloc
, opt
, gmsgid
, &ap
, DK_PEDWARN
);
1260 /* Same as pedwarn, but using RICHLOC. */
1263 pedwarn_at_rich_loc (rich_location
*richloc
, int opt
, const char *gmsgid
, ...)
1266 va_start (ap
, gmsgid
);
1267 bool ret
= diagnostic_impl (richloc
, opt
, gmsgid
, &ap
, DK_PEDWARN
);
1272 /* A "permissive" error at LOCATION: issues an error unless
1273 -fpermissive was given on the command line, in which case it issues
1274 a warning. Use this for things that really should be errors but we
1275 want to support legacy code.
1277 Returns true if the warning was printed, false if it was inhibited. */
1280 permerror (location_t location
, const char *gmsgid
, ...)
1283 va_start (ap
, gmsgid
);
1284 rich_location
richloc (line_table
, location
);
1285 bool ret
= diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_PERMERROR
);
1290 /* Same as "permerror", but at RICHLOC. */
1293 permerror_at_rich_loc (rich_location
*richloc
, const char *gmsgid
, ...)
1296 va_start (ap
, gmsgid
);
1297 bool ret
= diagnostic_impl (richloc
, -1, gmsgid
, &ap
, DK_PERMERROR
);
1302 /* A hard error: the code is definitely ill-formed, and an object file
1303 will not be produced. */
1305 error (const char *gmsgid
, ...)
1308 va_start (ap
, gmsgid
);
1309 rich_location
richloc (line_table
, input_location
);
1310 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_ERROR
);
1314 /* A hard error: the code is definitely ill-formed, and an object file
1315 will not be produced. */
1317 error_n (location_t location
, int n
, const char *singular_gmsgid
,
1318 const char *plural_gmsgid
, ...)
1321 va_start (ap
, plural_gmsgid
);
1322 diagnostic_n_impl (location
, -1, n
, singular_gmsgid
, plural_gmsgid
,
1327 /* Same as above, but use location LOC instead of input_location. */
1329 error_at (location_t loc
, const char *gmsgid
, ...)
1332 va_start (ap
, gmsgid
);
1333 rich_location
richloc (line_table
, loc
);
1334 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_ERROR
);
1338 /* Same as above, but use RICH_LOC. */
1341 error_at_rich_loc (rich_location
*richloc
, const char *gmsgid
, ...)
1344 va_start (ap
, gmsgid
);
1345 diagnostic_impl (richloc
, -1, gmsgid
, &ap
, DK_ERROR
);
1349 /* "Sorry, not implemented." Use for a language feature which is
1350 required by the relevant specification but not implemented by GCC.
1351 An object file will not be produced. */
1353 sorry (const char *gmsgid
, ...)
1356 va_start (ap
, gmsgid
);
1357 rich_location
richloc (line_table
, input_location
);
1358 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_SORRY
);
1362 /* Return true if an error or a "sorry" has been seen. Various
1363 processing is disabled after errors. */
1367 return errorcount
|| sorrycount
;
1370 /* An error which is severe enough that we make no attempt to
1371 continue. Do not use this for internal consistency checks; that's
1372 internal_error. Use of this function should be rare. */
1374 fatal_error (location_t loc
, const char *gmsgid
, ...)
1377 va_start (ap
, gmsgid
);
1378 rich_location
richloc (line_table
, loc
);
1379 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_FATAL
);
1385 /* An internal consistency check has failed. We make no attempt to
1386 continue. Note that unless there is debugging value to be had from
1387 a more specific message, or some other good reason, you should use
1388 abort () instead of calling this function directly. */
1390 internal_error (const char *gmsgid
, ...)
1393 va_start (ap
, gmsgid
);
1394 rich_location
richloc (line_table
, input_location
);
1395 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_ICE
);
1401 /* Like internal_error, but no backtrace will be printed. Used when
1402 the internal error does not happen at the current location, but happened
1405 internal_error_no_backtrace (const char *gmsgid
, ...)
1408 va_start (ap
, gmsgid
);
1409 rich_location
richloc (line_table
, input_location
);
1410 diagnostic_impl (&richloc
, -1, gmsgid
, &ap
, DK_ICE_NOBT
);
1416 /* Special case error functions. Most are implemented in terms of the
1417 above, or should be. */
1419 /* Print a diagnostic MSGID on FILE. This is just fprintf, except it
1420 runs its second argument through gettext. */
1422 fnotice (FILE *file
, const char *cmsgid
, ...)
1426 va_start (ap
, cmsgid
);
1427 vfprintf (file
, _(cmsgid
), ap
);
1431 /* Inform the user that an error occurred while trying to report some
1432 other error. This indicates catastrophic internal inconsistencies,
1433 so give up now. But do try to flush out the previous error.
1434 This mustn't use internal_error, that will cause infinite recursion. */
1437 error_recursion (diagnostic_context
*context
)
1439 if (context
->lock
< 3)
1440 pp_newline_and_flush (context
->printer
);
1443 "Internal compiler error: Error reporting routines re-entered.\n");
1445 /* Call diagnostic_action_after_output to get the "please submit a bug
1447 diagnostic_action_after_output (context
, DK_ICE
);
1449 /* Do not use gcc_unreachable here; that goes through internal_error
1450 and therefore would cause infinite recursion. */
1454 /* Report an internal compiler error in a friendly manner. This is
1455 the function that gets called upon use of abort() in the source
1456 code generally, thanks to a special macro. */
1459 fancy_abort (const char *file
, int line
, const char *function
)
1461 internal_error ("in %s, at %s:%d", function
, trim_filename (file
), line
);
1464 /* Really call the system 'abort'. This has to go right at the end of
1465 this file, so that there are no functions after it that call abort
1466 and get the system abort instead of our macro. */
1476 namespace selftest
{
1478 /* Helper function for test_print_escaped_string. */
1481 assert_print_escaped_string (const location
&loc
, const char *expected_output
,
1485 print_escaped_string (&pp
, input
);
1486 ASSERT_STREQ_AT (loc
, expected_output
, pp_formatted_text (&pp
));
1489 #define ASSERT_PRINT_ESCAPED_STRING_STREQ(EXPECTED_OUTPUT, INPUT) \
1490 assert_print_escaped_string (SELFTEST_LOCATION, EXPECTED_OUTPUT, INPUT)
1492 /* Tests of print_escaped_string. */
1495 test_print_escaped_string ()
1498 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"\"", "");
1500 /* Non-empty string. */
1501 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"hello world\"", "hello world");
1503 /* Various things that need to be escaped: */
1505 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"before\\\\after\"",
1508 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"before\\tafter\"",
1511 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"before\\nafter\"",
1514 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"before\\\"after\"",
1517 /* Non-printable characters: BEL: '\a': 0x07 */
1518 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"before\\007after\"",
1520 /* Non-printable characters: vertical tab: '\v': 0x0b */
1521 ASSERT_PRINT_ESCAPED_STRING_STREQ ("\"before\\013after\"",
1525 /* Tests of print_parseable_fixits. */
1527 /* Verify that print_parseable_fixits emits the empty string if there
1531 test_print_parseable_fixits_none ()
1534 rich_location
richloc (line_table
, UNKNOWN_LOCATION
);
1536 print_parseable_fixits (&pp
, &richloc
);
1537 ASSERT_STREQ ("", pp_formatted_text (&pp
));
1540 /* Verify that print_parseable_fixits does the right thing if there
1541 is an insertion fixit hint. */
1544 test_print_parseable_fixits_insert ()
1547 rich_location
richloc (line_table
, UNKNOWN_LOCATION
);
1549 linemap_add (line_table
, LC_ENTER
, false, "test.c", 0);
1550 linemap_line_start (line_table
, 5, 100);
1551 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
1552 location_t where
= linemap_position_for_column (line_table
, 10);
1553 richloc
.add_fixit_insert_before (where
, "added content");
1555 print_parseable_fixits (&pp
, &richloc
);
1556 ASSERT_STREQ ("fix-it:\"test.c\":{5:10-5:10}:\"added content\"\n",
1557 pp_formatted_text (&pp
));
1560 /* Verify that print_parseable_fixits does the right thing if there
1561 is an removal fixit hint. */
1564 test_print_parseable_fixits_remove ()
1567 rich_location
richloc (line_table
, UNKNOWN_LOCATION
);
1569 linemap_add (line_table
, LC_ENTER
, false, "test.c", 0);
1570 linemap_line_start (line_table
, 5, 100);
1571 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
1573 where
.m_start
= linemap_position_for_column (line_table
, 10);
1574 where
.m_finish
= linemap_position_for_column (line_table
, 20);
1575 richloc
.add_fixit_remove (where
);
1577 print_parseable_fixits (&pp
, &richloc
);
1578 ASSERT_STREQ ("fix-it:\"test.c\":{5:10-5:21}:\"\"\n",
1579 pp_formatted_text (&pp
));
1582 /* Verify that print_parseable_fixits does the right thing if there
1583 is an replacement fixit hint. */
1586 test_print_parseable_fixits_replace ()
1589 rich_location
richloc (line_table
, UNKNOWN_LOCATION
);
1591 linemap_add (line_table
, LC_ENTER
, false, "test.c", 0);
1592 linemap_line_start (line_table
, 5, 100);
1593 linemap_add (line_table
, LC_LEAVE
, false, NULL
, 0);
1595 where
.m_start
= linemap_position_for_column (line_table
, 10);
1596 where
.m_finish
= linemap_position_for_column (line_table
, 20);
1597 richloc
.add_fixit_replace (where
, "replacement");
1599 print_parseable_fixits (&pp
, &richloc
);
1600 ASSERT_STREQ ("fix-it:\"test.c\":{5:10-5:21}:\"replacement\"\n",
1601 pp_formatted_text (&pp
));
1604 /* Run all of the selftests within this file. */
1607 diagnostic_c_tests ()
1609 test_print_escaped_string ();
1610 test_print_parseable_fixits_none ();
1611 test_print_parseable_fixits_insert ();
1612 test_print_parseable_fixits_remove ();
1613 test_print_parseable_fixits_replace ();
1616 } // namespace selftest
1618 #endif /* #if CHECKING_P */