1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
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-2009, 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 variables common to error reporting packages
|
27 |
|
|
-- including Errout and Prj.Err.
|
28 |
|
|
|
29 |
|
|
with Namet; use Namet;
|
30 |
|
|
with Types; use Types;
|
31 |
|
|
with Uintp; use Uintp;
|
32 |
|
|
|
33 |
|
|
package Err_Vars is
|
34 |
|
|
|
35 |
|
|
-- All of these variables are set when needed, so they do not need to be
|
36 |
|
|
-- initialized. However, there is code that saves and restores existing
|
37 |
|
|
-- values, which may malfunction in -gnatVa mode if the variable has never
|
38 |
|
|
-- been iniitalized, so we initialize some variables to avoid exceptions
|
39 |
|
|
-- from invalid values in such cases.
|
40 |
|
|
|
41 |
|
|
------------------
|
42 |
|
|
-- Error Counts --
|
43 |
|
|
------------------
|
44 |
|
|
|
45 |
|
|
Serious_Errors_Detected : Nat := 0;
|
46 |
|
|
-- This is a count of errors that are serious enough to stop expansion,
|
47 |
|
|
-- and hence to prevent generation of an object file even if the
|
48 |
|
|
-- switch -gnatQ is set. Initialized to zero at the start of compilation.
|
49 |
|
|
-- Initialized for -gnatVa use, see comment above.
|
50 |
|
|
|
51 |
|
|
Total_Errors_Detected : Nat := 0;
|
52 |
|
|
-- Number of errors detected so far. Includes count of serious errors and
|
53 |
|
|
-- non-serious errors, so this value is always greater than or equal to the
|
54 |
|
|
-- Serious_Errors_Detected value. Initialized to zero at the start of
|
55 |
|
|
-- compilation. Initialized for -gnatVa use, see comment above.
|
56 |
|
|
|
57 |
|
|
Warnings_Detected : Nat := 0;
|
58 |
|
|
-- Number of warnings detected. Initialized to zero at the start of
|
59 |
|
|
-- compilation. Initialized for -gnatVa use, see comment above.
|
60 |
|
|
|
61 |
|
|
----------------------------------
|
62 |
|
|
-- Error Message Mode Variables --
|
63 |
|
|
----------------------------------
|
64 |
|
|
|
65 |
|
|
-- These variables control special error message modes. The initialized
|
66 |
|
|
-- values below give the normal default behavior, but they can be reset
|
67 |
|
|
-- by the caller to get different behavior as noted in the comments. These
|
68 |
|
|
-- variables are not reset by calls to the error message routines, so the
|
69 |
|
|
-- caller is responsible for resetting the default behavior after use.
|
70 |
|
|
|
71 |
|
|
Error_Msg_Qual_Level : Int;
|
72 |
|
|
-- Number of levels of qualification required for type name (see the
|
73 |
|
|
-- description of the } insertion character. Note that this value does
|
74 |
|
|
-- note get reset by any Error_Msg call, so the caller is responsible
|
75 |
|
|
-- for resetting it.
|
76 |
|
|
|
77 |
|
|
Warn_On_Instance : Boolean := False;
|
78 |
|
|
-- Normally if a warning is generated in a generic template from the
|
79 |
|
|
-- analysis of the template, then the warning really belongs in the
|
80 |
|
|
-- template, and the default value of False for this Boolean achieves
|
81 |
|
|
-- that effect. If Warn_On_Instance is set True, then the warnings are
|
82 |
|
|
-- generated on the instantiation (referring to the template) rather
|
83 |
|
|
-- than on the template itself.
|
84 |
|
|
|
85 |
|
|
Raise_Exception_On_Error : Nat := 0;
|
86 |
|
|
-- If this value is non-zero, then any attempt to generate an error
|
87 |
|
|
-- message raises the exception Error_Msg_Exception, and the error
|
88 |
|
|
-- message is not output. This is used for defending against junk
|
89 |
|
|
-- resulting from illegalities, and also for substitution of more
|
90 |
|
|
-- appropriate error messages from higher semantic levels. It is
|
91 |
|
|
-- a counter so that the increment/decrement protocol nests neatly.
|
92 |
|
|
-- Initialized for -gnatVa use, see comment above.
|
93 |
|
|
|
94 |
|
|
Error_Msg_Exception : exception;
|
95 |
|
|
-- Exception raised if Raise_Exception_On_Error is true
|
96 |
|
|
|
97 |
|
|
Current_Error_Source_File : Source_File_Index := Internal_Source_File;
|
98 |
|
|
-- Id of current messages. Used to post file name when unit changes. This
|
99 |
|
|
-- is initialized to Main_Source_File at the start of a compilation, which
|
100 |
|
|
-- means that no file names will be output unless there are errors in units
|
101 |
|
|
-- other than the main unit. However, if the main unit has a pragma
|
102 |
|
|
-- Source_Reference line, then this is initialized to No_Source_File,
|
103 |
|
|
-- to force an initial reference to the real source file name.
|
104 |
|
|
|
105 |
|
|
----------------------------------------
|
106 |
|
|
-- Error Message Insertion Parameters --
|
107 |
|
|
----------------------------------------
|
108 |
|
|
|
109 |
|
|
-- The error message routines work with strings that contain insertion
|
110 |
|
|
-- sequences that result in the insertion of variable data. The following
|
111 |
|
|
-- variables contain the required data. The procedure is to set one or more
|
112 |
|
|
-- of the following global variables to appropriate values before making a
|
113 |
|
|
-- call to one of the error message routines with a string containing the
|
114 |
|
|
-- insertion character to get the value inserted in an appropriate format.
|
115 |
|
|
|
116 |
|
|
Error_Msg_Col : Column_Number;
|
117 |
|
|
-- Column for @ insertion character in message
|
118 |
|
|
|
119 |
|
|
Error_Msg_Uint_1 : Uint;
|
120 |
|
|
Error_Msg_Uint_2 : Uint;
|
121 |
|
|
-- Uint values for ^ insertion characters in message
|
122 |
|
|
|
123 |
|
|
Error_Msg_Sloc : Source_Ptr;
|
124 |
|
|
-- Source location for # insertion character in message
|
125 |
|
|
|
126 |
|
|
Error_Msg_Name_1 : Name_Id;
|
127 |
|
|
Error_Msg_Name_2 : Name_Id;
|
128 |
|
|
Error_Msg_Name_3 : Name_Id;
|
129 |
|
|
-- Name_Id values for % insertion characters in message
|
130 |
|
|
|
131 |
|
|
Error_Msg_File_1 : File_Name_Type;
|
132 |
|
|
Error_Msg_File_2 : File_Name_Type;
|
133 |
|
|
Error_Msg_File_3 : File_Name_Type;
|
134 |
|
|
-- File_Name_Type values for { insertion characters in message
|
135 |
|
|
|
136 |
|
|
Error_Msg_Unit_1 : Unit_Name_Type;
|
137 |
|
|
Error_Msg_Unit_2 : Unit_Name_Type;
|
138 |
|
|
-- Unit_Name_Type values for $ insertion characters in message
|
139 |
|
|
|
140 |
|
|
Error_Msg_Node_1 : Node_Id;
|
141 |
|
|
Error_Msg_Node_2 : Node_Id;
|
142 |
|
|
-- Node_Id values for & insertion characters in message
|
143 |
|
|
|
144 |
|
|
Error_Msg_Warn : Boolean;
|
145 |
|
|
-- Used if current message contains a < insertion character to indicate
|
146 |
|
|
-- if the current message is a warning message.
|
147 |
|
|
|
148 |
|
|
Error_Msg_String : String (1 .. 4096);
|
149 |
|
|
Error_Msg_Strlen : Natural;
|
150 |
|
|
-- Used if current message contains a ~ insertion character to indicate
|
151 |
|
|
-- insertion of the string Error_Msg_String (1 .. Error_Msg_Strlen).
|
152 |
|
|
|
153 |
|
|
end Err_Vars;
|