OSDN Git Service

contrib/
[pf3gnuchains/gcc-fork.git] / gcc / diagnostic.c
1 /* Language-independent diagnostic subroutines for the GNU Compiler Collection
2    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
3    Free Software Foundation, Inc.
4    Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22
23 /* This file implements the language independent aspect of diagnostic
24    message module.  */
25
26 #include "config.h"
27 #undef FLOAT /* This is for hpux. They should change hpux.  */
28 #undef FFS  /* Some systems define this in param.h.  */
29 #include "system.h"
30 #include "coretypes.h"
31 #include "tm.h"
32 #include "tree.h"
33 #include "version.h"
34 #include "tm_p.h"
35 #include "flags.h"
36 #include "input.h"
37 #include "toplev.h"
38 #include "intl.h"
39 #include "diagnostic.h"
40 #include "langhooks.h"
41 #include "langhooks-def.h"
42 #include "opts.h"
43
44 #define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
45 #define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
46
47 /* Prototypes.  */
48 static char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
49
50 static void default_diagnostic_starter (diagnostic_context *,
51                                         diagnostic_info *);
52 static void default_diagnostic_finalizer (diagnostic_context *,
53                                           diagnostic_info *);
54
55 static void error_recursion (diagnostic_context *) ATTRIBUTE_NORETURN;
56
57 static void diagnostic_action_after_output (diagnostic_context *,
58                                             diagnostic_info *);
59 static void real_abort (void) ATTRIBUTE_NORETURN;
60
61 /* A diagnostic_context surrogate for stderr.  */
62 static diagnostic_context global_diagnostic_context;
63 diagnostic_context *global_dc = &global_diagnostic_context;
64
65 \f
66 /* Return a malloc'd string containing MSG formatted a la printf.  The
67    caller is responsible for freeing the memory.  */
68 static char *
69 build_message_string (const char *msg, ...)
70 {
71   char *str;
72   va_list ap;
73
74   va_start (ap, msg);
75   vasprintf (&str, msg, ap);
76   va_end (ap);
77
78   return str;
79 }
80
81 /* Same as diagnostic_build_prefix, but only the source FILE is given.  */
82 char *
83 file_name_as_prefix (const char *f)
84 {
85   return build_message_string ("%s: ", f);
86 }
87
88
89 \f
90 /* Initialize the diagnostic message outputting machinery.  */
91 void
92 diagnostic_initialize (diagnostic_context *context)
93 {
94   /* Allocate a basic pretty-printer.  Clients will replace this a
95      much more elaborated pretty-printer if they wish.  */
96   context->printer = XNEW (pretty_printer);
97   pp_construct (context->printer, NULL, 0);
98   /* By default, diagnostics are sent to stderr.  */
99   context->printer->buffer->stream = stderr;
100   /* By default, we emit prefixes once per message.  */
101   context->printer->wrapping.rule = DIAGNOSTICS_SHOW_PREFIX_ONCE;
102
103   memset (context->diagnostic_count, 0, sizeof context->diagnostic_count);
104   context->issue_warnings_are_errors_message = true;
105   context->warning_as_error_requested = false;
106   memset (context->classify_diagnostic, DK_UNSPECIFIED,
107           sizeof context->classify_diagnostic);
108   context->show_option_requested = false;
109   context->abort_on_error = false;
110   context->internal_error = NULL;
111   diagnostic_starter (context) = default_diagnostic_starter;
112   diagnostic_finalizer (context) = default_diagnostic_finalizer;
113   context->last_module = 0;
114   context->last_function = NULL;
115   context->lock = 0;
116 }
117
118 /* Initialize DIAGNOSTIC, where the message MSG has already been
119    translated.  */
120 void
121 diagnostic_set_info_translated (diagnostic_info *diagnostic, const char *msg,
122                                 va_list *args, location_t location,
123                                 diagnostic_t kind)
124 {
125   diagnostic->message.err_no = errno;
126   diagnostic->message.args_ptr = args;
127   diagnostic->message.format_spec = msg;
128   diagnostic->location = location;
129   diagnostic->kind = kind;
130   diagnostic->option_index = 0;
131 }
132
133 /* Initialize DIAGNOSTIC, where the message GMSGID has not yet been
134    translated.  */
135 void
136 diagnostic_set_info (diagnostic_info *diagnostic, const char *gmsgid,
137                      va_list *args, location_t location,
138                      diagnostic_t kind)
139 {
140   diagnostic_set_info_translated (diagnostic, _(gmsgid), args, location, kind);
141 }
142
143 /* Return a malloc'd string describing a location.  The caller is
144    responsible for freeing the memory.  */
145 char *
146 diagnostic_build_prefix (diagnostic_info *diagnostic)
147 {
148   static const char *const diagnostic_kind_text[] = {
149 #define DEFINE_DIAGNOSTIC_KIND(K, T) (T),
150 #include "diagnostic.def"
151 #undef DEFINE_DIAGNOSTIC_KIND
152     "must-not-happen"
153   };
154   const char *text = _(diagnostic_kind_text[diagnostic->kind]);
155   expanded_location s = expand_location (diagnostic->location);
156   gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
157
158   return
159     (s.file == NULL
160      ? build_message_string ("%s: %s", progname, text)
161      : flag_show_column && s.column != 0
162      ? build_message_string ("%s:%d:%d: %s", s.file, s.line, s.column, text)
163      : build_message_string ("%s:%d: %s", s.file, s.line, text));
164 }
165
166 /* Take any action which is expected to happen after the diagnostic
167    is written out.  This function does not always return.  */
168 static void
169 diagnostic_action_after_output (diagnostic_context *context,
170                                 diagnostic_info *diagnostic)
171 {
172   switch (diagnostic->kind)
173     {
174     case DK_DEBUG:
175     case DK_NOTE:
176     case DK_ANACHRONISM:
177     case DK_WARNING:
178       break;
179
180     case DK_ERROR:
181     case DK_SORRY:
182       if (context->abort_on_error)
183         real_abort ();
184       if (flag_fatal_errors)
185         {
186           fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n");
187           exit (FATAL_EXIT_CODE);
188         }
189       break;
190
191     case DK_ICE:
192       if (context->abort_on_error)
193         real_abort ();
194
195       fnotice (stderr, "Please submit a full bug report,\n"
196                "with preprocessed source if appropriate.\n"
197                "See %s for instructions.\n", bug_report_url);
198       exit (ICE_EXIT_CODE);
199
200     case DK_FATAL:
201       if (context->abort_on_error)
202         real_abort ();
203
204       fnotice (stderr, "compilation terminated.\n");
205       exit (FATAL_EXIT_CODE);
206
207     default:
208       gcc_unreachable ();
209     }
210 }
211
212 /* Prints out, if necessary, the name of the current function
213    that caused an error.  Called from all error and warning functions.  */
214 void
215 diagnostic_report_current_function (diagnostic_context *context,
216                                     diagnostic_info *diagnostic)
217 {
218   diagnostic_report_current_module (context);
219   lang_hooks.print_error_function (context, input_filename, diagnostic);
220 }
221
222 void
223 diagnostic_report_current_module (diagnostic_context *context)
224 {
225   const struct line_map *map;
226
227   if (pp_needs_newline (context->printer))
228     {
229       pp_newline (context->printer);
230       pp_needs_newline (context->printer) = false;
231     }
232
233   if (input_location <= BUILTINS_LOCATION)
234     return;
235
236   map = linemap_lookup (line_table, input_location);
237   if (map && diagnostic_last_module_changed (context, map))
238     {
239       diagnostic_set_last_module (context, map);
240       if (! MAIN_FILE_P (map))
241         {
242           map = INCLUDED_FROM (line_table, map);
243           pp_verbatim (context->printer,
244                        "In file included from %s:%d",
245                        map->to_file, LAST_SOURCE_LINE (map));
246           while (! MAIN_FILE_P (map))
247             {
248               map = INCLUDED_FROM (line_table, map);
249               pp_verbatim (context->printer,
250                            ",\n                 from %s:%d",
251                            map->to_file, LAST_SOURCE_LINE (map));
252             }
253           pp_verbatim (context->printer, ":");
254           pp_newline (context->printer);
255         }
256     }
257 }
258
259 static void
260 default_diagnostic_starter (diagnostic_context *context,
261                             diagnostic_info *diagnostic)
262 {
263   diagnostic_report_current_function (context, diagnostic);
264   pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
265 }
266
267 static void
268 default_diagnostic_finalizer (diagnostic_context *context,
269                               diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
270 {
271   pp_destroy_prefix (context->printer);
272 }
273
274 /* Interface to specify diagnostic kind overrides.  Returns the
275    previous setting, or DK_UNSPECIFIED if the parameters are out of
276    range.  */
277 diagnostic_t
278 diagnostic_classify_diagnostic (diagnostic_context *context,
279                                 int option_index,
280                                 diagnostic_t new_kind)
281 {
282   diagnostic_t old_kind;
283
284   if (option_index <= 0
285       || option_index >= N_OPTS
286       || new_kind >= DK_LAST_DIAGNOSTIC_KIND)
287     return DK_UNSPECIFIED;
288
289   old_kind = context->classify_diagnostic[option_index];
290   context->classify_diagnostic[option_index] = new_kind;
291   return old_kind;
292 }
293
294 /* Report a diagnostic message (an error or a warning) as specified by
295    DC.  This function is *the* subroutine in terms of which front-ends
296    should implement their specific diagnostic handling modules.  The
297    front-end independent format specifiers are exactly those described
298    in the documentation of output_format.  
299    Return true if a diagnostic was printed, false otherwise.  */
300
301 bool
302 diagnostic_report_diagnostic (diagnostic_context *context,
303                               diagnostic_info *diagnostic)
304 {
305   location_t location = diagnostic->location;
306   bool maybe_print_warnings_as_errors_message = false;
307   const char *saved_format_spec;
308
309   /* Give preference to being able to inhibit warnings, before they
310      get reclassified to something else.  */
311   if ((diagnostic->kind == DK_WARNING || diagnostic->kind == DK_PEDWARN)
312       && !diagnostic_report_warnings_p (location))
313     return false;
314
315   if (diagnostic->kind == DK_PEDWARN) 
316     diagnostic->kind = pedantic_warning_kind ();
317   
318   if (context->lock > 0)
319     {
320       /* If we're reporting an ICE in the middle of some other error,
321          try to flush out the previous error, then let this one
322          through.  Don't do this more than once.  */
323       if (diagnostic->kind == DK_ICE && context->lock == 1)
324         pp_flush (context->printer);
325       else
326         error_recursion (context);
327     }
328
329   /* If the user requested that warnings be treated as errors, so be
330      it.  Note that we do this before the next block so that
331      individual warnings can be overridden back to warnings with
332      -Wno-error=*.  */
333   if (context->warning_as_error_requested
334       && diagnostic->kind == DK_WARNING)
335     {
336       diagnostic->kind = DK_ERROR;
337       maybe_print_warnings_as_errors_message = true;
338     }
339   
340   if (diagnostic->option_index)
341     {
342       /* This tests if the user provided the appropriate -Wfoo or
343          -Wno-foo option.  */
344       if (! option_enabled (diagnostic->option_index))
345         return false;
346       /* This tests if the user provided the appropriate -Werror=foo
347          option.  */
348       if (context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED)
349         {
350           diagnostic->kind = context->classify_diagnostic[diagnostic->option_index];
351           maybe_print_warnings_as_errors_message = false;
352         }
353       /* This allows for future extensions, like temporarily disabling
354          warnings for ranges of source code.  */
355       if (diagnostic->kind == DK_IGNORED)
356         return false;
357     }
358
359   /* If we changed the kind due to -Werror, and didn't override it, we
360      need to print this message.  */
361   if (context->issue_warnings_are_errors_message
362       && maybe_print_warnings_as_errors_message)
363     {
364       pp_verbatim (context->printer,
365                    "%s: warnings being treated as errors\n", progname);
366       context->issue_warnings_are_errors_message = false;
367     }
368
369   context->lock++;
370
371   if (diagnostic->kind == DK_ICE) 
372     {
373 #ifndef ENABLE_CHECKING
374       /* When not checking, ICEs are converted to fatal errors when an
375          error has already occurred.  This is counteracted by
376          abort_on_error.  */
377       if ((diagnostic_kind_count (context, DK_ERROR) > 0
378            || diagnostic_kind_count (context, DK_SORRY) > 0)
379           && !context->abort_on_error)
380         {
381           expanded_location s = expand_location (diagnostic->location);
382           fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",
383                    s.file, s.line);
384           exit (ICE_EXIT_CODE);
385         }
386 #endif
387       if (context->internal_error)
388         (*context->internal_error) (diagnostic->message.format_spec,
389                                     diagnostic->message.args_ptr);
390     }
391   ++diagnostic_kind_count (context, diagnostic->kind);
392   
393   saved_format_spec = diagnostic->message.format_spec;
394   if (context->show_option_requested && diagnostic->option_index)
395     diagnostic->message.format_spec
396       = ACONCAT ((diagnostic->message.format_spec,
397                   " [", cl_options[diagnostic->option_index].opt_text, "]", NULL));
398   
399   diagnostic->message.locus = &diagnostic->location;
400   diagnostic->message.abstract_origin = &diagnostic->abstract_origin;
401   diagnostic->abstract_origin = NULL;
402   pp_format (context->printer, &diagnostic->message);
403   (*diagnostic_starter (context)) (context, diagnostic);
404   pp_output_formatted_text (context->printer);
405   (*diagnostic_finalizer (context)) (context, diagnostic);
406   pp_flush (context->printer);
407   diagnostic_action_after_output (context, diagnostic);
408   diagnostic->message.format_spec = saved_format_spec;
409   diagnostic->abstract_origin = NULL;
410
411   context->lock--;
412
413   return true;
414 }
415
416 /* Given a partial pathname as input, return another pathname that
417    shares no directory elements with the pathname of __FILE__.  This
418    is used by fancy_abort() to print `Internal compiler error in expr.c'
419    instead of `Internal compiler error in ../../GCC/gcc/expr.c'.  */
420
421 const char *
422 trim_filename (const char *name)
423 {
424   static const char this_file[] = __FILE__;
425   const char *p = name, *q = this_file;
426
427   /* First skip any "../" in each filename.  This allows us to give a proper
428      reference to a file in a subdirectory.  */
429   while (p[0] == '.' && p[1] == '.' && IS_DIR_SEPARATOR (p[2]))
430     p += 3;
431
432   while (q[0] == '.' && q[1] == '.' && IS_DIR_SEPARATOR (q[2]))
433     q += 3;
434
435   /* Now skip any parts the two filenames have in common.  */
436   while (*p == *q && *p != 0 && *q != 0)
437     p++, q++;
438
439   /* Now go backwards until the previous directory separator.  */
440   while (p > name && !IS_DIR_SEPARATOR (p[-1]))
441     p--;
442
443   return p;
444 }
445 \f
446 /* Standard error reporting routines in increasing order of severity.
447    All of these take arguments like printf.  */
448
449 /* Text to be emitted verbatim to the error message stream; this
450    produces no prefix and disables line-wrapping.  Use rarely.  */
451 void
452 verbatim (const char *gmsgid, ...)
453 {
454   text_info text;
455   va_list ap;
456
457   va_start (ap, gmsgid);
458   text.err_no = errno;
459   text.args_ptr = &ap;
460   text.format_spec = _(gmsgid);
461   text.locus = NULL;
462   text.abstract_origin = NULL;
463   pp_format_verbatim (global_dc->printer, &text);
464   pp_flush (global_dc->printer);
465   va_end (ap);
466 }
467
468 bool
469 emit_diagnostic (diagnostic_t kind, location_t location, int opt, 
470                  const char *gmsgid, ...)
471 {
472   diagnostic_info diagnostic;
473   va_list ap;
474
475   va_start (ap, gmsgid);
476   if (kind == DK_PERMERROR)
477     {
478       diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
479                            permissive_error_kind ());
480       diagnostic.option_index = OPT_fpermissive;
481     }
482   else {
483       diagnostic_set_info (&diagnostic, gmsgid, &ap, location, kind);
484       if (kind == DK_WARNING || kind == DK_PEDWARN)
485         diagnostic.option_index = opt;
486   }
487   va_end (ap);
488
489   return report_diagnostic (&diagnostic);
490 }
491
492 /* An informative note at LOCATION.  Use this for additional details on an error
493    message.  */
494 void
495 inform (location_t location, const char *gmsgid, ...)
496 {
497   diagnostic_info diagnostic;
498   va_list ap;
499
500   va_start (ap, gmsgid);
501   diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_NOTE);
502   report_diagnostic (&diagnostic);
503   va_end (ap);
504 }
505
506 /* A warning at INPUT_LOCATION.  Use this for code which is correct according
507    to the relevant language specification but is likely to be buggy anyway.  
508    Returns true if the warning was printed, false if it was inhibited.  */
509 bool
510 warning (int opt, const char *gmsgid, ...)
511 {
512   diagnostic_info diagnostic;
513   va_list ap;
514
515   va_start (ap, gmsgid);
516   diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_WARNING);
517   diagnostic.option_index = opt;
518
519   va_end (ap);
520   return report_diagnostic (&diagnostic);
521 }
522
523 /* A warning at LOCATION.  Use this for code which is correct according to the
524    relevant language specification but is likely to be buggy anyway.
525    Returns true if the warning was printed, false if it was inhibited.  */
526
527 bool
528 warning_at (location_t location, int opt, const char *gmsgid, ...)
529 {
530   diagnostic_info diagnostic;
531   va_list ap;
532
533   va_start (ap, gmsgid);
534   diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
535   diagnostic.option_index = opt;
536   va_end (ap);
537   return report_diagnostic (&diagnostic);
538 }
539
540 /* A "pedantic" warning at LOCATION: issues a warning unless
541    -pedantic-errors was given on the command line, in which case it
542    issues an error.  Use this for diagnostics required by the relevant
543    language standard, if you have chosen not to make them errors.
544
545    Note that these diagnostics are issued independent of the setting
546    of the -pedantic command-line switch.  To get a warning enabled
547    only with that switch, use either "if (pedantic) pedwarn
548    (OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)".  To get a
549    pedwarn independently of the -pedantic switch use "pedwarn (0,...)".
550
551    Returns true if the warning was printed, false if it was inhibited.  */
552
553 bool
554 pedwarn (location_t location, int opt, const char *gmsgid, ...)
555 {
556   diagnostic_info diagnostic;
557   va_list ap;
558
559   va_start (ap, gmsgid);
560   diagnostic_set_info (&diagnostic, gmsgid, &ap, location,  DK_PEDWARN);
561   diagnostic.option_index = opt;
562   va_end (ap);
563   return report_diagnostic (&diagnostic);
564 }
565
566 /* A "permissive" error at LOCATION: issues an error unless
567    -fpermissive was given on the command line, in which case it issues
568    a warning.  Use this for things that really should be errors but we
569    want to support legacy code.
570
571    Returns true if the warning was printed, false if it was inhibited.  */
572
573 bool
574 permerror (location_t location, const char *gmsgid, ...)
575 {
576   diagnostic_info diagnostic;
577   va_list ap;
578
579   va_start (ap, gmsgid);
580   diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
581                        permissive_error_kind ());
582   diagnostic.option_index = OPT_fpermissive;
583   va_end (ap);
584   return report_diagnostic (&diagnostic);
585 }
586
587 /* A hard error: the code is definitely ill-formed, and an object file
588    will not be produced.  */
589 void
590 error (const char *gmsgid, ...)
591 {
592   diagnostic_info diagnostic;
593   va_list ap;
594
595   va_start (ap, gmsgid);
596   diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ERROR);
597   report_diagnostic (&diagnostic);
598   va_end (ap);
599 }
600
601 /* Same as ebove, but use location LOC instead of input_location.  */
602 void
603 error_at (location_t loc, const char *gmsgid, ...)
604 {
605   diagnostic_info diagnostic;
606   va_list ap;
607
608   va_start (ap, gmsgid);
609   diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_ERROR);
610   report_diagnostic (&diagnostic);
611   va_end (ap);
612 }
613
614 /* "Sorry, not implemented."  Use for a language feature which is
615    required by the relevant specification but not implemented by GCC.
616    An object file will not be produced.  */
617 void
618 sorry (const char *gmsgid, ...)
619 {
620   diagnostic_info diagnostic;
621   va_list ap;
622
623   va_start (ap, gmsgid);
624   diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_SORRY);
625   report_diagnostic (&diagnostic);
626   va_end (ap);
627 }
628
629 /* An error which is severe enough that we make no attempt to
630    continue.  Do not use this for internal consistency checks; that's
631    internal_error.  Use of this function should be rare.  */
632 void
633 fatal_error (const char *gmsgid, ...)
634 {
635   diagnostic_info diagnostic;
636   va_list ap;
637
638   va_start (ap, gmsgid);
639   diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_FATAL);
640   report_diagnostic (&diagnostic);
641   va_end (ap);
642
643   gcc_unreachable ();
644 }
645
646 /* An internal consistency check has failed.  We make no attempt to
647    continue.  Note that unless there is debugging value to be had from
648    a more specific message, or some other good reason, you should use
649    abort () instead of calling this function directly.  */
650 void
651 internal_error (const char *gmsgid, ...)
652 {
653   diagnostic_info diagnostic;
654   va_list ap;
655
656   va_start (ap, gmsgid);
657   diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ICE);
658   report_diagnostic (&diagnostic);
659   va_end (ap);
660
661   gcc_unreachable ();
662 }
663 \f
664 /* Special case error functions.  Most are implemented in terms of the
665    above, or should be.  */
666
667 /* Print a diagnostic MSGID on FILE.  This is just fprintf, except it
668    runs its second argument through gettext.  */
669 void
670 fnotice (FILE *file, const char *cmsgid, ...)
671 {
672   va_list ap;
673
674   va_start (ap, cmsgid);
675   vfprintf (file, _(cmsgid), ap);
676   va_end (ap);
677 }
678
679 /* Inform the user that an error occurred while trying to report some
680    other error.  This indicates catastrophic internal inconsistencies,
681    so give up now.  But do try to flush out the previous error.
682    This mustn't use internal_error, that will cause infinite recursion.  */
683
684 static void
685 error_recursion (diagnostic_context *context)
686 {
687   diagnostic_info diagnostic;
688
689   if (context->lock < 3)
690     pp_flush (context->printer);
691
692   fnotice (stderr,
693            "Internal compiler error: Error reporting routines re-entered.\n");
694
695   /* Call diagnostic_action_after_output to get the "please submit a bug
696      report" message.  It only looks at the kind field of diagnostic_info.  */
697   diagnostic.kind = DK_ICE;
698   diagnostic_action_after_output (context, &diagnostic);
699
700   /* Do not use gcc_unreachable here; that goes through internal_error
701      and therefore would cause infinite recursion.  */
702   real_abort ();
703 }
704
705 /* Report an internal compiler error in a friendly manner.  This is
706    the function that gets called upon use of abort() in the source
707    code generally, thanks to a special macro.  */
708
709 void
710 fancy_abort (const char *file, int line, const char *function)
711 {
712   internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
713 }
714
715 /* Really call the system 'abort'.  This has to go right at the end of
716    this file, so that there are no functions after it that call abort
717    and get the system abort instead of our macro.  */
718 #undef abort
719 static void
720 real_abort (void)
721 {
722   abort ();
723 }