OSDN Git Service

2007-08-14 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / err_vars.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             E R R _ V A R S                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2007, 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 2,  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 COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package contains variables common to error reporting packages
28 --  including Errout and Prj.Err.
29
30 with Namet; use Namet;
31 with Types; use Types;
32 with Uintp; use Uintp;
33
34 package Err_Vars is
35
36    ------------------
37    -- Error Counts --
38    ------------------
39
40    Serious_Errors_Detected : Nat;
41    --  This is a count of errors that are serious enough to stop expansion,
42    --  and hence to prevent generation of an object file even if the
43    --  switch -gnatQ is set. Initialized to zero at the start of compilation.
44
45    Total_Errors_Detected : Nat;
46    --  Number of errors detected so far. Includes count of serious errors and
47    --  non-serious errors, so this value is always greater than or equal to the
48    --  Serious_Errors_Detected value. Initialized to zero at the start of
49    --  compilation.
50
51    Warnings_Detected : Nat;
52    --  Number of warnings detected. Initialized to zero at the start of
53    --  compilation.
54
55    ----------------------------------
56    -- Error Message Mode Variables --
57    ----------------------------------
58
59    --  These variables control special error message modes. The initialized
60    --  values below give the normal default behavior, but they can be reset
61    --  by the caller to get different behavior as noted in the comments. These
62    --  variables are not reset by calls to the error message routines, so the
63    --  caller is responsible for resetting the default behavior after use.
64
65    Error_Msg_Qual_Level : Int;
66    --  Number of levels of qualification required for type name (see the
67    --  description of the } insertion character. Note that this value does
68    --  note get reset by any Error_Msg call, so the caller is responsible
69    --  for resetting it.
70
71    Warn_On_Instance : Boolean;
72    --  Normally if a warning is generated in a generic template from the
73    --  analysis of the template, then the warning really belongs in the
74    --  template, and the default value of False for this Boolean achieves
75    --  that effect. If Warn_On_Instance is set True, then the warnings are
76    --  generated on the instantiation (referring to the template) rather
77    --  than on the template itself.
78
79    Raise_Exception_On_Error : Nat;
80    --  If this value is non-zero, then any attempt to generate an error
81    --  message raises the exception Error_Msg_Exception, and the error
82    --  message is not output. This is used for defending against junk
83    --  resulting from illegalities, and also for substitution of more
84    --  appropriate error messages from higher semantic levels. It is
85    --  a counter so that the increment/decrement protocol nests neatly.
86
87    Error_Msg_Exception : exception;
88    --  Exception raised if Raise_Exception_On_Error is true
89
90    Current_Error_Source_File : Source_File_Index := Internal_Source_File;
91    --  Id of current messages. Used to post file name when unit changes. This
92    --  is initialized to Main_Source_File at the start of a compilation, which
93    --  means that no file names will be output unless there are errors in units
94    --  other than the main unit. However, if the main unit has a pragma
95    --  Source_Reference line, then this is initialized to No_Source_File,
96    --  to force an initial reference to the real source file name.
97
98    ----------------------------------------
99    -- Error Message Insertion Parameters --
100    ----------------------------------------
101
102    --  The error message routines work with strings that contain insertion
103    --  sequences that result in the insertion of variable data. The following
104    --  variables contain the required data. The procedure is to set one or more
105    --  of the following global variables to appropriate values before making a
106    --  call to one of the error message routines with a string containing the
107    --  insertion character to get the value inserted in an appropriate format.
108
109    Error_Msg_Col : Column_Number;
110    --  Column for @ insertion character in message
111
112    Error_Msg_Uint_1 : Uint;
113    Error_Msg_Uint_2 : Uint;
114    --  Uint values for ^ insertion characters in message
115
116    Error_Msg_Sloc : Source_Ptr;
117    --  Source location for # insertion character in message
118
119    Error_Msg_Name_1 : Name_Id;
120    Error_Msg_Name_2 : Name_Id;
121    Error_Msg_Name_3 : Name_Id;
122    --  Name_Id values for % insertion characters in message
123
124    Error_Msg_File_1 : File_Name_Type;
125    Error_Msg_File_2 : File_Name_Type;
126    Error_Msg_File_3 : File_Name_Type;
127    --  File_Name_Type values for { insertion characters in message
128
129    Error_Msg_Unit_1 : Unit_Name_Type;
130    Error_Msg_Unit_2 : Unit_Name_Type;
131    --  Unit_Name_Type values for $ insertion characters in message
132
133    Error_Msg_Node_1 : Node_Id;
134    Error_Msg_Node_2 : Node_Id;
135    --  Node_Id values for & insertion characters in message
136
137    Error_Msg_Warn : Boolean;
138    --  Used if current message contains a < insertion character to indicate
139    --  if the current message is a warning message.
140
141    Error_Msg_String : String (1 .. 4096);
142    Error_Msg_Strlen : Natural;
143    --  Used if current message contains a ~ insertion character to indicate
144    --  insertion of the string Error_Msg_String (1 .. Error_Msg_Strlen).
145
146 end Err_Vars;