1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                              C O M P E R R                               --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
10--                                                                          --
11-- GNAT is free software;  you can  redistribute it  and/or modify it under --
12-- terms of the  GNU General Public License as published  by the Free Soft- --
13-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17-- for  more details.  You should have  received  a copy of the GNU General --
18-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license.          --
20--                                                                          --
21-- GNAT was originally developed  by the GNAT team at  New York University. --
22-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23--                                                                          --
24------------------------------------------------------------------------------
25
26--  This package contains the routine called when a fatal internal compiler
27--  error is detected. Calls to this routines cause termination of the
28--  current compilation with appropriate error output.
29
30package Comperr is
31
32   procedure Compiler_Abort
33     (X            : String;
34      Code         : Integer := 0;
35      Fallback_Loc : String := "");
36   pragma No_Return (Compiler_Abort);
37   --  Signals an internal compiler error. Never returns control. Depending on
38   --  processing may end up raising Unrecoverable_Error, or exiting directly.
39   --  The message output is a "bug box" containing the first string passed as
40   --  an argument. The Sloc field of the node in Current_Error_Node is used to
41   --  provide the location where the error should be signalled. If this Sloc
42   --  value is set to No_Location or any of the other special location values,
43   --  then the Fallback_Loc argument string is used instead. The message text
44   --  includes the node id, and the code parameter if it is positive.
45   --
46   --  Note that this is only used at the outer level (to handle constraint
47   --  errors or assert errors etc.) In the normal logic of the compiler we
48   --  always use pragma Assert to check for errors, and if necessary an
49   --  explicit abort is achieved by pragma Assert (False). Code is positive
50   --  for a gigi abort (giving the gigi abort code), zero for a front
51   --  end exception (with possible message stored in TSD.Current_Excep,
52   --  and negative (an unused value) for a GCC abort.
53
54   procedure Delete_SCIL_Files;
55   --  Delete SCIL files associated with the main unit
56
57   ------------------------------
58   -- Use of gnat_bug.box File --
59   ------------------------------
60
61   --  When comperr generates the "bug box". The first two lines contain
62   --  information on the version number, type of abort, and source location.
63
64   --  Normally the remaining text is one of three possible forms
65   --  depending on Gnatvsn.Gnat_Version_Type (FSF, Public, GNATPRO).
66   --  See body of this package for the exact text used.
67
68   --  In addition, an alternative mechanism exists for easily substituting
69   --  different text for this message. Compiler_Abort checks for the
70   --  existence of the file "gnat_bug.box" in the current source path.
71   --  Most typically this file, if present, will be in the directory
72   --  containing the run-time sources.
73
74   --  If this file is present, then it is a plain ASCII file, whose contents
75   --  replace the remaining text. The lines in this file should be seventy-two
76   --  characters or less to avoid misformatting the right boundary of the box.
77   --  Note that the file does not contain the vertical bar characters or any
78   --  leading spaces in lines.
79
80end Comperr;
81