1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- E R R O U T --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1992-2012, 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 routines to output error messages. They are
|
27 |
|
|
-- basically system independent, however in some environments, e.g. when the
|
28 |
|
|
-- parser is embedded into an editor, it may be appropriate to replace the
|
29 |
|
|
-- implementation of this package.
|
30 |
|
|
|
31 |
|
|
with Err_Vars;
|
32 |
|
|
with Erroutc;
|
33 |
|
|
with Namet; use Namet;
|
34 |
|
|
with Table;
|
35 |
|
|
with Types; use Types;
|
36 |
|
|
with Uintp; use Uintp;
|
37 |
|
|
|
38 |
|
|
with System;
|
39 |
|
|
|
40 |
|
|
package Errout is
|
41 |
|
|
|
42 |
|
|
Serious_Errors_Detected : Nat renames Err_Vars.Serious_Errors_Detected;
|
43 |
|
|
-- This is a count of errors that are serious enough to stop expansion,
|
44 |
|
|
-- and hence to prevent generation of an object file even if the switch
|
45 |
|
|
-- -gnatQ is set.
|
46 |
|
|
|
47 |
|
|
Total_Errors_Detected : Nat renames Err_Vars.Total_Errors_Detected;
|
48 |
|
|
-- Number of errors detected so far. Includes count of serious errors and
|
49 |
|
|
-- non-serious errors, so this value is always greater than or equal to
|
50 |
|
|
-- the Serious_Errors_Detected value.
|
51 |
|
|
|
52 |
|
|
Warnings_Detected : Nat renames Err_Vars.Warnings_Detected;
|
53 |
|
|
-- Number of warnings detected
|
54 |
|
|
|
55 |
|
|
Configurable_Run_Time_Violations : Nat := 0;
|
56 |
|
|
-- Count of configurable run time violations so far. This is used to
|
57 |
|
|
-- suppress certain cascaded error messages when we know that we may not
|
58 |
|
|
-- have fully expanded some items, due to high integrity violations (i.e.
|
59 |
|
|
-- the use of constructs not permitted by the library in use, or improper
|
60 |
|
|
-- constructs in No_Run_Time mode).
|
61 |
|
|
|
62 |
|
|
Current_Error_Source_File : Source_File_Index
|
63 |
|
|
renames Err_Vars.Current_Error_Source_File;
|
64 |
|
|
-- Id of current messages. Used to post file name when unit changes. This
|
65 |
|
|
-- is initialized to Main_Source_File at the start of a compilation, which
|
66 |
|
|
-- means that no file names will be output unless there are errors in
|
67 |
|
|
-- units other than the main unit. However, if the main unit has a pragma
|
68 |
|
|
-- Source_Reference line, then this is initialized to No_Source_File, to
|
69 |
|
|
-- force an initial reference to the real source file name.
|
70 |
|
|
|
71 |
|
|
Raise_Exception_On_Error : Nat renames Err_Vars.Raise_Exception_On_Error;
|
72 |
|
|
-- If this value is non-zero, then any attempt to generate an error
|
73 |
|
|
-- message raises the exception Error_Msg_Exception, and the error message
|
74 |
|
|
-- is not output. This is used for defending against junk resulting from
|
75 |
|
|
-- illegalities, and also for substitution of more appropriate error
|
76 |
|
|
-- messages from higher semantic levels. It is a counter so that the
|
77 |
|
|
-- increment/decrement protocol nests neatly.
|
78 |
|
|
|
79 |
|
|
Error_Msg_Exception : exception renames Err_Vars.Error_Msg_Exception;
|
80 |
|
|
-- Exception raised if Raise_Exception_On_Error is true
|
81 |
|
|
|
82 |
|
|
-----------------------------------
|
83 |
|
|
-- Suppression of Error Messages --
|
84 |
|
|
-----------------------------------
|
85 |
|
|
|
86 |
|
|
-- In an effort to reduce the impact of redundant error messages, the
|
87 |
|
|
-- error output routines in this package normally suppress certain
|
88 |
|
|
-- classes of messages as follows:
|
89 |
|
|
|
90 |
|
|
-- 1. Identical messages placed at the same point in the text. Such
|
91 |
|
|
-- duplicate error message result for example from rescanning
|
92 |
|
|
-- sections of the text that contain lexical errors. Only one of
|
93 |
|
|
-- such a set of duplicate messages is output, and the rest are
|
94 |
|
|
-- suppressed.
|
95 |
|
|
|
96 |
|
|
-- 2. If more than one parser message is generated for a single source
|
97 |
|
|
-- line, then only the first message is output, the remaining
|
98 |
|
|
-- messages on the same line are suppressed.
|
99 |
|
|
|
100 |
|
|
-- 3. If a message is posted on a node for which a message has been
|
101 |
|
|
-- previously posted, then only the first message is retained. The
|
102 |
|
|
-- Error_Posted flag is used to detect such multiple postings. Note
|
103 |
|
|
-- that this only applies to semantic messages, since otherwise
|
104 |
|
|
-- for parser messages, this would be a special case of case 2.
|
105 |
|
|
|
106 |
|
|
-- 4. If a message is posted on a node whose Etype or Entity
|
107 |
|
|
-- fields reference entities on which an error message has
|
108 |
|
|
-- already been placed, as indicated by the Error_Posted flag
|
109 |
|
|
-- being set on these entities, then the message is suppressed.
|
110 |
|
|
|
111 |
|
|
-- 5. If a message attempts to insert an Error node, or a direct
|
112 |
|
|
-- reference to the Any_Type node, then the message is suppressed.
|
113 |
|
|
|
114 |
|
|
-- 6. Note that cases 2-5 only apply to error messages, not warning
|
115 |
|
|
-- messages. Warning messages are only suppressed for case 1, and
|
116 |
|
|
-- when they come from other than the main extended unit.
|
117 |
|
|
|
118 |
|
|
-- This normal suppression action may be overridden in cases 2-5 (but not
|
119 |
|
|
-- in case 1) by setting All_Errors mode, or by setting the special
|
120 |
|
|
-- unconditional message insertion character (!) at the end of the message
|
121 |
|
|
-- text as described below.
|
122 |
|
|
|
123 |
|
|
---------------------------------------------------------
|
124 |
|
|
-- Error Message Text and Message Insertion Characters --
|
125 |
|
|
---------------------------------------------------------
|
126 |
|
|
|
127 |
|
|
-- Error message text strings are composed of lower case letters, digits
|
128 |
|
|
-- and the special characters space, comma, period, colon and semicolon,
|
129 |
|
|
-- apostrophe and parentheses. Special insertion characters can also
|
130 |
|
|
-- appear which cause the error message circuit to modify the given
|
131 |
|
|
-- string as follows:
|
132 |
|
|
|
133 |
|
|
-- Insertion character % (Percent: insert name from Names table)
|
134 |
|
|
-- The character % is replaced by the text for the name specified by
|
135 |
|
|
-- the Name_Id value stored in Error_Msg_Name_1. A blank precedes the
|
136 |
|
|
-- name if it is preceded by a non-blank character other than left
|
137 |
|
|
-- parenthesis. The name is enclosed in quotes unless manual quotation
|
138 |
|
|
-- mode is set. If the Name_Id is set to No_Name, then no insertion
|
139 |
|
|
-- occurs; if the Name_Id is set to Error_Name, then the string
|
140 |
|
|
-- <error> is inserted. A second and third % may appear in a single
|
141 |
|
|
-- message, similarly replaced by the names which are specified by the
|
142 |
|
|
-- Name_Id values stored in Error_Msg_Name_2 and Error_Msg_Name_3. The
|
143 |
|
|
-- names are decoded and cased according to the current identifier
|
144 |
|
|
-- casing mode. Note: if a unit name ending with %b or %s is passed
|
145 |
|
|
-- for this kind of insertion, this suffix is simply stripped. Use a
|
146 |
|
|
-- unit name insertion ($) to process the suffix.
|
147 |
|
|
|
148 |
|
|
-- Insertion character %% (Double percent: insert literal name)
|
149 |
|
|
-- The character sequence %% acts as described above for %, except
|
150 |
|
|
-- that the name is simply obtained with Get_Name_String and is not
|
151 |
|
|
-- decoded or cased, it is inserted literally from the names table.
|
152 |
|
|
-- A trailing %b or %s is not treated specially.
|
153 |
|
|
|
154 |
|
|
-- Insertion character $ (Dollar: insert unit name from Names table)
|
155 |
|
|
-- The character $ is treated similarly to %, except that the name is
|
156 |
|
|
-- obtained from the Unit_Name_Type value in Error_Msg_Unit_1 and
|
157 |
|
|
-- Error_Msg_Unit_2, as provided by Get_Unit_Name_String in package
|
158 |
|
|
-- Uname. Note that this name includes the postfix (spec) or (body)
|
159 |
|
|
-- strings. If this postfix is not required, use the normal %
|
160 |
|
|
-- insertion for the unit name.
|
161 |
|
|
|
162 |
|
|
-- Insertion character { (Left brace: insert file name from names table)
|
163 |
|
|
-- The character { is treated similarly to %, except that the input
|
164 |
|
|
-- value is a File_Name_Type value stored in Error_Msg_File_1 or
|
165 |
|
|
-- Error_Msg_File_2 or Error_Msg_File_3. The value is output literally,
|
166 |
|
|
-- enclosed in quotes as for %, but the case is not modified, the
|
167 |
|
|
-- insertion is the exact string stored in the names table without
|
168 |
|
|
-- adjusting the casing.
|
169 |
|
|
|
170 |
|
|
-- Insertion character * (Asterisk, insert reserved word name)
|
171 |
|
|
-- The insertion character * is treated exactly like % except that the
|
172 |
|
|
-- resulting name is cased according to the default conventions for
|
173 |
|
|
-- reserved words (see package Scans).
|
174 |
|
|
|
175 |
|
|
-- Insertion character & (Ampersand: insert name from node)
|
176 |
|
|
-- The insertion character & is treated similarly to %, except that
|
177 |
|
|
-- the name is taken from the Chars field of the given node, and may
|
178 |
|
|
-- refer to a child unit name, or a selected component. The casing is,
|
179 |
|
|
-- if possible, taken from the original source reference, which is
|
180 |
|
|
-- obtained from the Sloc field of the given node or nodes. If no Sloc
|
181 |
|
|
-- is available (happens e.g. for nodes in package Standard), then the
|
182 |
|
|
-- default case (see Scans spec) is used. The nodes to be used are
|
183 |
|
|
-- stored in Error_Msg_Node_1, Error_Msg_Node_2. No insertion occurs
|
184 |
|
|
-- for the Empty node, and the Error node results in the insertion of
|
185 |
|
|
-- the characters <error>. In addition, if the special global variable
|
186 |
|
|
-- Error_Msg_Qual_Level is non-zero, then the reference will include
|
187 |
|
|
-- up to the given number of levels of qualification, using the scope
|
188 |
|
|
-- chain.
|
189 |
|
|
|
190 |
|
|
-- Insertion character # (Pound: insert line number reference)
|
191 |
|
|
-- The character # is replaced by the string indicating the source
|
192 |
|
|
-- position stored in Error_Msg_Sloc. There are three cases:
|
193 |
|
|
--
|
194 |
|
|
-- for package Standard: in package Standard
|
195 |
|
|
-- for locations in current file: at line nnn:ccc
|
196 |
|
|
-- for locations in other files: at filename:nnn:ccc
|
197 |
|
|
--
|
198 |
|
|
-- By convention, the # insertion character is only used at the end of
|
199 |
|
|
-- an error message, so the above strings only appear as the last
|
200 |
|
|
-- characters of an error message. The only exceptions to this rule
|
201 |
|
|
-- are that an RM reference may follow in the form (RM .....) and a
|
202 |
|
|
-- right parenthesis may immediately follow the #. In the case of
|
203 |
|
|
-- continued messages, # can only appear at the end of a group of
|
204 |
|
|
-- continuation messages, except that \\ messages which always start
|
205 |
|
|
-- a new line end the sequence from the point of view of this rule.
|
206 |
|
|
-- The idea is that for any use of -gnatj, it will still be the case
|
207 |
|
|
-- that a location reference appears only at the end of a line.
|
208 |
|
|
|
209 |
|
|
-- Note: the output of the string "at " is suppressed if the string
|
210 |
|
|
-- " from" or " from " immediately precedes the insertion character #.
|
211 |
|
|
-- Certain messages read better with from than at.
|
212 |
|
|
|
213 |
|
|
-- Insertion character } (Right brace: insert type reference)
|
214 |
|
|
-- The character } is replaced by a string describing the type
|
215 |
|
|
-- referenced by the entity whose Id is stored in Error_Msg_Node_1.
|
216 |
|
|
-- the string gives the name or description of the type, and also
|
217 |
|
|
-- where appropriate the location of its declaration. Special cases
|
218 |
|
|
-- like "some integer type" are handled appropriately. Only one } is
|
219 |
|
|
-- allowed in a message, since there is not enough room for two (the
|
220 |
|
|
-- insertion can be quite long, including a file name) In addition, if
|
221 |
|
|
-- the special global variable Error_Msg_Qual_Level is non-zero, then
|
222 |
|
|
-- the reference will include up to the given number of levels of
|
223 |
|
|
-- qualification, using the scope chain.
|
224 |
|
|
|
225 |
|
|
-- Insertion character @ (At: insert column number reference)
|
226 |
|
|
-- The character @ is replaced by null if the RM_Column_Check mode is
|
227 |
|
|
-- off (False). If the switch is on (True), then @ is replaced by the
|
228 |
|
|
-- text string " in column nnn" where nnn is the decimal
|
229 |
|
|
-- representation of the column number stored in Error_Msg_Col plus
|
230 |
|
|
-- one (the plus one is because the number is stored 0-origin and
|
231 |
|
|
-- displayed 1-origin).
|
232 |
|
|
|
233 |
|
|
-- Insertion character ^ (Carret: insert integer value)
|
234 |
|
|
-- The character ^ is replaced by the decimal conversion of the Uint
|
235 |
|
|
-- value stored in Error_Msg_Uint_1, with a possible leading minus.
|
236 |
|
|
-- A second ^ may occur in the message, in which case it is replaced
|
237 |
|
|
-- by the decimal conversion of the Uint value in Error_Msg_Uint_2.
|
238 |
|
|
|
239 |
|
|
-- Insertion character > (Right bracket, run time name)
|
240 |
|
|
-- The character > is replaced by a string of the form (name) if
|
241 |
|
|
-- Targparm scanned out a Run_Time_Name (see package Targparm for
|
242 |
|
|
-- details). The name is enclosed in parentheses and output in mixed
|
243 |
|
|
-- case mode (upper case after any space in the name). If no run time
|
244 |
|
|
-- name is defined, this insertion character has no effect.
|
245 |
|
|
|
246 |
|
|
-- Insertion character ! (Exclamation: unconditional message)
|
247 |
|
|
-- The character ! appearing as the last character of a message makes
|
248 |
|
|
-- the message unconditional which means that it is output even if it
|
249 |
|
|
-- would normally be suppressed. See section above for a description
|
250 |
|
|
-- of the cases in which messages are normally suppressed. Note that
|
251 |
|
|
-- in the case of warnings, the meaning is that the warning should not
|
252 |
|
|
-- be removed in dead code (that's the only time that the use of !
|
253 |
|
|
-- has any effect for a warning).
|
254 |
|
|
--
|
255 |
|
|
-- Note: the presence of ! is ignored in continuation messages (i.e.
|
256 |
|
|
-- messages starting with the \ insertion character). The effect of the
|
257 |
|
|
-- use of ! in a parent message automatically applies to all of its
|
258 |
|
|
-- continuation messages (since we clearly don't want any case in which
|
259 |
|
|
-- continuations are separated from the parent message. It is allowable
|
260 |
|
|
-- to put ! in continuation messages, and the usual style is to include
|
261 |
|
|
-- it, since it makes it clear that the continuation is part of an
|
262 |
|
|
-- unconditional message.
|
263 |
|
|
|
264 |
|
|
-- Insertion character !! (Double exclamation: unconditional warning)
|
265 |
|
|
-- Normally warning messages issued in other than the main unit are
|
266 |
|
|
-- suppressed. If the message ends with !! then this suppression is
|
267 |
|
|
-- avoided. This is currently used by the Compile_Time_Warning pragma
|
268 |
|
|
-- to ensure the message for a with'ed unit is output, and for warnings
|
269 |
|
|
-- on ineffective back-end inlining, which is detected in units that
|
270 |
|
|
-- contain subprograms to be inlined in the main program.
|
271 |
|
|
|
272 |
|
|
-- Insertion character ? (Question: warning message)
|
273 |
|
|
-- The character ? appearing anywhere in a message makes the message
|
274 |
|
|
-- warning instead of a normal error message, and the text of the
|
275 |
|
|
-- message will be preceded by "warning:" in the normal case. The
|
276 |
|
|
-- handling of warnings if further controlled by the Warning_Mode
|
277 |
|
|
-- option (-w switch), see package Opt for further details, and also by
|
278 |
|
|
-- the current setting from pragma Warnings. This pragma applies only
|
279 |
|
|
-- to warnings issued from the semantic phase (not the parser), but
|
280 |
|
|
-- currently all relevant warnings are posted by the semantic phase
|
281 |
|
|
-- anyway. Messages starting with (style) are also treated as warning
|
282 |
|
|
-- messages.
|
283 |
|
|
--
|
284 |
|
|
-- Note: when a warning message is output, the text of the message is
|
285 |
|
|
-- preceded by "warning: " in the normal case. An exception to this
|
286 |
|
|
-- rule occurs when the text of the message starts with "info: " in
|
287 |
|
|
-- which case this string is not prepended. This allows callers to
|
288 |
|
|
-- label certain warnings as informational messages, rather than as
|
289 |
|
|
-- warning messages requiring some action.
|
290 |
|
|
--
|
291 |
|
|
-- Note: the presence of ? is ignored in continuation messages (i.e.
|
292 |
|
|
-- messages starting with the \ insertion character). The warning
|
293 |
|
|
-- status of continuations is determined only by the parent message
|
294 |
|
|
-- which is being continued. It is allowable to put ? in continuation
|
295 |
|
|
-- messages, and the usual style is to include it, since it makes it
|
296 |
|
|
-- clear that the continuation is part of a warning message.
|
297 |
|
|
|
298 |
|
|
-- Insertion character < (Less Than: conditional warning message)
|
299 |
|
|
-- The character < appearing anywhere in a message is used for a
|
300 |
|
|
-- conditional error message. If Error_Msg_Warn is True, then the
|
301 |
|
|
-- effect is the same as ? described above. If Error_Msg_Warn is
|
302 |
|
|
-- False, then there is no effect.
|
303 |
|
|
|
304 |
|
|
-- Insertion character A-Z (Upper case letter: Ada reserved word)
|
305 |
|
|
-- If two or more upper case letters appear in the message, they are
|
306 |
|
|
-- taken as an Ada reserved word, and are converted to the default
|
307 |
|
|
-- case for reserved words (see Scans package spec). Surrounding
|
308 |
|
|
-- quotes are added unless manual quotation mode is currently set.
|
309 |
|
|
|
310 |
|
|
-- Insertion character ` (Backquote: set manual quotation mode)
|
311 |
|
|
-- The backquote character always appears in pairs. Each backquote of
|
312 |
|
|
-- the pair is replaced by a double quote character. In addition, any
|
313 |
|
|
-- reserved keywords, or name insertions between these backquotes are
|
314 |
|
|
-- not surrounded by the usual automatic double quotes. See the
|
315 |
|
|
-- section below on manual quotation mode for further details.
|
316 |
|
|
|
317 |
|
|
-- Insertion character ' (Quote: literal character)
|
318 |
|
|
-- Precedes a character which is placed literally into the message.
|
319 |
|
|
-- Used to insert characters into messages that are one of the
|
320 |
|
|
-- insertion characters defined here. Also useful in inserting
|
321 |
|
|
-- sequences of upper case letters which are not to be treated as
|
322 |
|
|
-- keywords.
|
323 |
|
|
|
324 |
|
|
-- Insertion character \ (Backslash: continuation message)
|
325 |
|
|
-- Indicates that the message is a continuation of a message
|
326 |
|
|
-- previously posted. This is used to ensure that such groups of
|
327 |
|
|
-- messages are treated as a unit. The \ character must be the first
|
328 |
|
|
-- character of the message text.
|
329 |
|
|
|
330 |
|
|
-- Insertion character \\ (Two backslashes, continuation with new line)
|
331 |
|
|
-- This differs from \ only in -gnatjnn mode (Error_Message_Line_Length
|
332 |
|
|
-- set non-zero). This sequence forces a new line to start even when
|
333 |
|
|
-- continuations are being gathered into a single message.
|
334 |
|
|
|
335 |
|
|
-- Insertion character | (Vertical bar: non-serious error)
|
336 |
|
|
-- By default, error messages (other than warning messages) are
|
337 |
|
|
-- considered to be fatal error messages which prevent expansion or
|
338 |
|
|
-- generation of code in the presence of the -gnatQ switch. If the
|
339 |
|
|
-- insertion character | appears, the message is considered to be
|
340 |
|
|
-- non-serious, and does not cause Serious_Errors_Detected to be
|
341 |
|
|
-- incremented (so expansion is not prevented by such a msg).
|
342 |
|
|
|
343 |
|
|
-- Insertion character ~ (Tilde: insert string)
|
344 |
|
|
-- Indicates that Error_Msg_String (1 .. Error_Msg_Strlen) is to be
|
345 |
|
|
-- inserted to replace the ~ character. The string is inserted in the
|
346 |
|
|
-- literal form it appears, without any action on special characters.
|
347 |
|
|
|
348 |
|
|
----------------------------------------
|
349 |
|
|
-- Specialization of Messages for VMS --
|
350 |
|
|
----------------------------------------
|
351 |
|
|
|
352 |
|
|
-- Some messages mention gcc-style switch names. When using an OpenVMS
|
353 |
|
|
-- host, such switch names must be converted to their corresponding VMS
|
354 |
|
|
-- qualifer. The following table controls this translation. In each case
|
355 |
|
|
-- the original message must contain the string "-xxx switch", where xxx
|
356 |
|
|
-- is the Gname? entry from below, and this string will be replaced by
|
357 |
|
|
-- "/yyy qualifier", where yyy is the corresponding Vname? entry.
|
358 |
|
|
|
359 |
|
|
Gname1 : aliased constant String := "fno-strict-aliasing";
|
360 |
|
|
Vname1 : aliased constant String := "OPTIMIZE=NO_STRICT_ALIASING";
|
361 |
|
|
|
362 |
|
|
Gname2 : aliased constant String := "gnatX";
|
363 |
|
|
Vname2 : aliased constant String := "EXTENSIONS_ALLOWED";
|
364 |
|
|
|
365 |
|
|
Gname3 : aliased constant String := "gnatW";
|
366 |
|
|
Vname3 : aliased constant String := "WIDE_CHARACTER_ENCODING";
|
367 |
|
|
|
368 |
|
|
Gname4 : aliased constant String := "gnatf";
|
369 |
|
|
Vname4 : aliased constant String := "REPORT_ERRORS=FULL";
|
370 |
|
|
|
371 |
|
|
Gname5 : aliased constant String := "gnat05";
|
372 |
|
|
Vname5 : aliased constant String := "05";
|
373 |
|
|
|
374 |
|
|
Gname6 : aliased constant String := "gnat2005";
|
375 |
|
|
Vname6 : aliased constant String := "2005";
|
376 |
|
|
|
377 |
|
|
Gname7 : aliased constant String := "gnat12";
|
378 |
|
|
Vname7 : aliased constant String := "12";
|
379 |
|
|
|
380 |
|
|
Gname8 : aliased constant String := "gnat2012";
|
381 |
|
|
Vname8 : aliased constant String := "2012";
|
382 |
|
|
|
383 |
|
|
type Cstring_Ptr is access constant String;
|
384 |
|
|
|
385 |
|
|
Gnames : array (Nat range <>) of Cstring_Ptr :=
|
386 |
|
|
(Gname1'Access,
|
387 |
|
|
Gname2'Access,
|
388 |
|
|
Gname3'Access,
|
389 |
|
|
Gname4'Access,
|
390 |
|
|
Gname5'Access,
|
391 |
|
|
Gname6'Access,
|
392 |
|
|
Gname7'Access,
|
393 |
|
|
Gname8'Access);
|
394 |
|
|
|
395 |
|
|
Vnames : array (Nat range <>) of Cstring_Ptr :=
|
396 |
|
|
(Vname1'Access,
|
397 |
|
|
Vname2'Access,
|
398 |
|
|
Vname3'Access,
|
399 |
|
|
Vname4'Access,
|
400 |
|
|
Vname5'Access,
|
401 |
|
|
Vname6'Access,
|
402 |
|
|
Vname7'Access,
|
403 |
|
|
Vname8'Access);
|
404 |
|
|
|
405 |
|
|
-----------------------------------------------------
|
406 |
|
|
-- Global Values Used for Error Message Insertions --
|
407 |
|
|
-----------------------------------------------------
|
408 |
|
|
|
409 |
|
|
-- The following global variables are essentially additional parameters
|
410 |
|
|
-- passed to the error message routine for insertion sequences described
|
411 |
|
|
-- above. The reason these are passed globally is that the insertion
|
412 |
|
|
-- mechanism is essentially an untyped one in which the appropriate
|
413 |
|
|
-- variables are set depending on the specific insertion characters used.
|
414 |
|
|
|
415 |
|
|
-- Note that is mandatory that the caller ensure that global variables
|
416 |
|
|
-- are set before the Error_Msg call, otherwise the result is undefined.
|
417 |
|
|
|
418 |
|
|
Error_Msg_Col : Column_Number renames Err_Vars.Error_Msg_Col;
|
419 |
|
|
-- Column for @ insertion character in message
|
420 |
|
|
|
421 |
|
|
Error_Msg_Uint_1 : Uint renames Err_Vars.Error_Msg_Uint_1;
|
422 |
|
|
Error_Msg_Uint_2 : Uint renames Err_Vars.Error_Msg_Uint_2;
|
423 |
|
|
-- Uint values for ^ insertion characters in message
|
424 |
|
|
|
425 |
|
|
Error_Msg_Sloc : Source_Ptr renames Err_Vars.Error_Msg_Sloc;
|
426 |
|
|
-- Source location for # insertion character in message
|
427 |
|
|
|
428 |
|
|
Error_Msg_Name_1 : Name_Id renames Err_Vars.Error_Msg_Name_1;
|
429 |
|
|
Error_Msg_Name_2 : Name_Id renames Err_Vars.Error_Msg_Name_2;
|
430 |
|
|
Error_Msg_Name_3 : Name_Id renames Err_Vars.Error_Msg_Name_3;
|
431 |
|
|
-- Name_Id values for % insertion characters in message
|
432 |
|
|
|
433 |
|
|
Error_Msg_File_1 : File_Name_Type renames Err_Vars.Error_Msg_File_1;
|
434 |
|
|
Error_Msg_File_2 : File_Name_Type renames Err_Vars.Error_Msg_File_2;
|
435 |
|
|
Error_Msg_File_3 : File_Name_Type renames Err_Vars.Error_Msg_File_3;
|
436 |
|
|
-- File_Name_Type values for { insertion characters in message
|
437 |
|
|
|
438 |
|
|
Error_Msg_Unit_1 : Unit_Name_Type renames Err_Vars.Error_Msg_Unit_1;
|
439 |
|
|
Error_Msg_Unit_2 : Unit_Name_Type renames Err_Vars.Error_Msg_Unit_2;
|
440 |
|
|
-- Unit_Name_Type values for $ insertion characters in message
|
441 |
|
|
|
442 |
|
|
Error_Msg_Node_1 : Node_Id renames Err_Vars.Error_Msg_Node_1;
|
443 |
|
|
Error_Msg_Node_2 : Node_Id renames Err_Vars.Error_Msg_Node_2;
|
444 |
|
|
-- Node_Id values for & insertion characters in message
|
445 |
|
|
|
446 |
|
|
Error_Msg_Qual_Level : Int renames Err_Vars.Error_Msg_Qual_Level;
|
447 |
|
|
-- Number of levels of qualification required for type name (see the
|
448 |
|
|
-- description of the } insertion character). Note that this value does
|
449 |
|
|
-- note get reset by any Error_Msg call, so the caller is responsible
|
450 |
|
|
-- for resetting it.
|
451 |
|
|
|
452 |
|
|
Error_Msg_Warn : Boolean renames Err_Vars.Error_Msg_Warn;
|
453 |
|
|
-- Used if current message contains a < insertion character to indicate
|
454 |
|
|
-- if the current message is a warning message. Must be set appropriately
|
455 |
|
|
-- before any call to Error_Msg_xxx with a < insertion character present.
|
456 |
|
|
-- Setting is irrelevant if no < insertion character is present.
|
457 |
|
|
|
458 |
|
|
Error_Msg_String : String renames Err_Vars.Error_Msg_String;
|
459 |
|
|
Error_Msg_Strlen : Natural renames Err_Vars.Error_Msg_Strlen;
|
460 |
|
|
-- Used if current message contains a ~ insertion character to indicate
|
461 |
|
|
-- insertion of the string Error_Msg_String (1 .. Error_Msg_Strlen).
|
462 |
|
|
|
463 |
|
|
-----------------------------------------------------
|
464 |
|
|
-- Format of Messages and Manual Quotation Control --
|
465 |
|
|
-----------------------------------------------------
|
466 |
|
|
|
467 |
|
|
-- Messages are generally all in lower case, except for inserted names
|
468 |
|
|
-- and appear in one of the following three forms:
|
469 |
|
|
|
470 |
|
|
-- error: text
|
471 |
|
|
-- warning: text
|
472 |
|
|
|
473 |
|
|
-- The prefixes error and warning are supplied automatically (depending
|
474 |
|
|
-- on the use of the ? insertion character), and the call to the error
|
475 |
|
|
-- message routine supplies the text. The "error: " prefix is omitted
|
476 |
|
|
-- in brief error message formats.
|
477 |
|
|
|
478 |
|
|
-- Reserved Ada keywords in the message are in the default keyword case
|
479 |
|
|
-- (determined from the given source program), surrounded by quotation
|
480 |
|
|
-- marks. This is achieved by spelling the reserved word in upper case
|
481 |
|
|
-- letters, which is recognized as a request for insertion of quotation
|
482 |
|
|
-- marks by the error text processor. Thus for example:
|
483 |
|
|
|
484 |
|
|
-- Error_Msg_AP ("IS expected");
|
485 |
|
|
|
486 |
|
|
-- would result in the output of one of the following:
|
487 |
|
|
|
488 |
|
|
-- error: "is" expected
|
489 |
|
|
-- error: "IS" expected
|
490 |
|
|
-- error: "Is" expected
|
491 |
|
|
|
492 |
|
|
-- the choice between these being made by looking at the casing convention
|
493 |
|
|
-- used for keywords (actually the first compilation unit keyword) in the
|
494 |
|
|
-- source file.
|
495 |
|
|
|
496 |
|
|
-- Note: a special exception is that RM is never treated as a keyword
|
497 |
|
|
-- but instead is copied literally into the message, this avoids the
|
498 |
|
|
-- need for writing 'R'M for all reference manual quotes. A similar
|
499 |
|
|
-- exception is applied to the occurrence of the string Alfa used in
|
500 |
|
|
-- error messages about the Alfa subset of Ada.
|
501 |
|
|
|
502 |
|
|
-- In the case of names, the default mode for the error text processor
|
503 |
|
|
-- is to surround the name by quotation marks automatically. The case
|
504 |
|
|
-- used for the identifier names is taken from the source program where
|
505 |
|
|
-- possible, and otherwise is the default casing convention taken from
|
506 |
|
|
-- the source file usage.
|
507 |
|
|
|
508 |
|
|
-- In some cases, better control over the placement of quote marks is
|
509 |
|
|
-- required. This is achieved using manual quotation mode. In this mode,
|
510 |
|
|
-- one or more insertion sequences is surrounded by backquote characters.
|
511 |
|
|
-- The backquote characters are output as double quote marks, and normal
|
512 |
|
|
-- automatic insertion of quotes is suppressed between the double quotes.
|
513 |
|
|
-- For example:
|
514 |
|
|
|
515 |
|
|
-- Error_Msg_AP ("`END &;` expected");
|
516 |
|
|
|
517 |
|
|
-- generates a message like
|
518 |
|
|
|
519 |
|
|
-- error: "end Open_Scope;" expected
|
520 |
|
|
|
521 |
|
|
-- where the node specifying the name Open_Scope has been stored in
|
522 |
|
|
-- Error_Msg_Node_1 prior to the call. The great majority of error
|
523 |
|
|
-- messages operates in normal quotation mode.
|
524 |
|
|
|
525 |
|
|
-- Note: the normal automatic insertion of spaces before insertion
|
526 |
|
|
-- sequences (such as those that come from & and %) is suppressed in
|
527 |
|
|
-- manual quotation mode, so blanks, if needed as in the above example,
|
528 |
|
|
-- must be explicitly present.
|
529 |
|
|
|
530 |
|
|
----------------------------
|
531 |
|
|
-- Message ID Definitions --
|
532 |
|
|
----------------------------
|
533 |
|
|
|
534 |
|
|
subtype Error_Msg_Id is Erroutc.Error_Msg_Id;
|
535 |
|
|
function "=" (Left, Right : Error_Msg_Id) return Boolean
|
536 |
|
|
renames Erroutc."=";
|
537 |
|
|
-- A type used to represent specific error messages. Used by the clients
|
538 |
|
|
-- of this package only in the context of the Get_Error_Id and
|
539 |
|
|
-- Change_Error_Text subprograms.
|
540 |
|
|
|
541 |
|
|
No_Error_Msg : constant Error_Msg_Id := Erroutc.No_Error_Msg;
|
542 |
|
|
-- A constant which is different from any value returned by Get_Error_Id.
|
543 |
|
|
-- Typically used by a client to indicate absense of a saved Id value.
|
544 |
|
|
|
545 |
|
|
function Get_Msg_Id return Error_Msg_Id renames Erroutc.Get_Msg_Id;
|
546 |
|
|
-- Returns the Id of the message most recently posted using one of the
|
547 |
|
|
-- Error_Msg routines.
|
548 |
|
|
|
549 |
|
|
function Get_Location (E : Error_Msg_Id) return Source_Ptr
|
550 |
|
|
renames Erroutc.Get_Location;
|
551 |
|
|
-- Returns the flag location of the error message with the given id E
|
552 |
|
|
|
553 |
|
|
------------------------
|
554 |
|
|
-- List Pragmas Table --
|
555 |
|
|
------------------------
|
556 |
|
|
|
557 |
|
|
-- When a pragma Page or pragma List is encountered by the parser, an
|
558 |
|
|
-- entry is made in the following table. This table is then used to
|
559 |
|
|
-- control the full listing if one is being generated. Note that the
|
560 |
|
|
-- reason we do the processing in the parser is so that we get proper
|
561 |
|
|
-- listing control even in syntax check only mode.
|
562 |
|
|
|
563 |
|
|
type List_Pragma_Type is (List_On, List_Off, Page);
|
564 |
|
|
|
565 |
|
|
type List_Pragma_Record is record
|
566 |
|
|
Ptyp : List_Pragma_Type;
|
567 |
|
|
Ploc : Source_Ptr;
|
568 |
|
|
end record;
|
569 |
|
|
|
570 |
|
|
-- Note: Ploc points to the terminating semicolon in the List_Off and Page
|
571 |
|
|
-- cases, and to the pragma keyword for List_On. In the case of a pragma
|
572 |
|
|
-- List_Off, a List_On entry is also made in the table, pointing to the
|
573 |
|
|
-- pragma keyword. This ensures that, as required, a List (Off) pragma is
|
574 |
|
|
-- listed even in list off mode.
|
575 |
|
|
|
576 |
|
|
package List_Pragmas is new Table.Table (
|
577 |
|
|
Table_Component_Type => List_Pragma_Record,
|
578 |
|
|
Table_Index_Type => Int,
|
579 |
|
|
Table_Low_Bound => 1,
|
580 |
|
|
Table_Initial => 50,
|
581 |
|
|
Table_Increment => 200,
|
582 |
|
|
Table_Name => "List_Pragmas");
|
583 |
|
|
|
584 |
|
|
---------------------------
|
585 |
|
|
-- Ignore_Errors Feature --
|
586 |
|
|
---------------------------
|
587 |
|
|
|
588 |
|
|
-- In certain cases, notably for optional subunits, the compiler operates
|
589 |
|
|
-- in a mode where errors are to be ignored, and the whole unit is to be
|
590 |
|
|
-- considered as not present. To implement this we provide the following
|
591 |
|
|
-- flag to enable special handling, where error messages are suppressed,
|
592 |
|
|
-- but the Fatal_Error flag will still be set in the normal manner.
|
593 |
|
|
|
594 |
|
|
Ignore_Errors_Enable : Nat := 0;
|
595 |
|
|
-- Triggering switch. If non-zero, then ignore errors mode is activated.
|
596 |
|
|
-- This is a counter to allow convenient nesting of enable/disable.
|
597 |
|
|
|
598 |
|
|
-----------------------
|
599 |
|
|
-- CODEFIX Facility --
|
600 |
|
|
-----------------------
|
601 |
|
|
|
602 |
|
|
-- The GPS and GNATBench IDE's have a codefix facility that allows for
|
603 |
|
|
-- automatic correction of a subset of the errors and warnings issued
|
604 |
|
|
-- by the compiler. This is done by recognizing the text of specific
|
605 |
|
|
-- messages using appropriate matching patterns.
|
606 |
|
|
|
607 |
|
|
-- The text of such messages should not be altered without coordinating
|
608 |
|
|
-- with the codefix code. All such messages are marked by a specific
|
609 |
|
|
-- style of comments, as shown by the following example:
|
610 |
|
|
|
611 |
|
|
-- Error_Msg_N -- CODEFIX
|
612 |
|
|
-- (parameters ....)
|
613 |
|
|
|
614 |
|
|
-- Any message marked with this -- CODEFIX comment should not be modified
|
615 |
|
|
-- without appropriate coordination.
|
616 |
|
|
|
617 |
|
|
------------------------------
|
618 |
|
|
-- Error Output Subprograms --
|
619 |
|
|
------------------------------
|
620 |
|
|
|
621 |
|
|
procedure Initialize;
|
622 |
|
|
-- Initializes for output of error messages. Must be called for each
|
623 |
|
|
-- source file before using any of the other routines in the package.
|
624 |
|
|
|
625 |
|
|
procedure Finalize (Last_Call : Boolean);
|
626 |
|
|
-- Finalize processing of error message list. Includes processing for
|
627 |
|
|
-- duplicated error messages, and other similar final adjustment of the
|
628 |
|
|
-- list of error messages. Note that this procedure must be called before
|
629 |
|
|
-- calling Compilation_Errors to determine if there were any errors. It
|
630 |
|
|
-- is perfectly fine to call Finalize more than once, providing that the
|
631 |
|
|
-- parameter Last_Call is set False for every call except the last call.
|
632 |
|
|
|
633 |
|
|
-- This multiple call capability is used to do some processing that may
|
634 |
|
|
-- generate messages. Call Finalize to eliminate duplicates and remove
|
635 |
|
|
-- deleted warnings. Test for compilation errors using Compilation_Errors,
|
636 |
|
|
-- then generate some more errors/warnings, call Finalize again to make
|
637 |
|
|
-- sure that all duplicates in these new messages are dealt with, then
|
638 |
|
|
-- finally call Output_Messages to output the final list of messages. The
|
639 |
|
|
-- argument Last_Call must be set False on all calls except the last call,
|
640 |
|
|
-- and must be set True on the last call (a value of True activates some
|
641 |
|
|
-- processing that must only be done after all messages are posted).
|
642 |
|
|
|
643 |
|
|
procedure Output_Messages;
|
644 |
|
|
-- Output list of messages, including messages giving number of detected
|
645 |
|
|
-- errors and warnings.
|
646 |
|
|
|
647 |
|
|
procedure Error_Msg (Msg : String; Flag_Location : Source_Ptr);
|
648 |
|
|
-- Output a message at specified location. Can be called from the parser
|
649 |
|
|
-- or the semantic analyzer.
|
650 |
|
|
|
651 |
|
|
procedure Error_Msg_S (Msg : String);
|
652 |
|
|
-- Output a message at current scan pointer location. This routine can be
|
653 |
|
|
-- called only from the parser, since it references Scan_Ptr.
|
654 |
|
|
|
655 |
|
|
procedure Error_Msg_AP (Msg : String);
|
656 |
|
|
-- Output a message just after the previous token. This routine can be
|
657 |
|
|
-- called only from the parser, since it references Prev_Token_Ptr.
|
658 |
|
|
|
659 |
|
|
procedure Error_Msg_BC (Msg : String);
|
660 |
|
|
-- Output a message just before the current token. Note that the important
|
661 |
|
|
-- difference between this and the previous routine is that the BC case
|
662 |
|
|
-- posts a flag on the current line, whereas AP can post a flag at the
|
663 |
|
|
-- end of the preceding line. This routine can be called only from the
|
664 |
|
|
-- parser, since it references Token_Ptr.
|
665 |
|
|
|
666 |
|
|
procedure Error_Msg_SC (Msg : String);
|
667 |
|
|
-- Output a message at the start of the current token, unless we are at
|
668 |
|
|
-- the end of file, in which case we always output the message after the
|
669 |
|
|
-- last real token in the file. This routine can be called only from the
|
670 |
|
|
-- parser, since it references Token_Ptr.
|
671 |
|
|
|
672 |
|
|
procedure Error_Msg_SP (Msg : String);
|
673 |
|
|
-- Output a message at the start of the previous token. This routine can
|
674 |
|
|
-- be called only from the parser, since it references Prev_Token_Ptr.
|
675 |
|
|
|
676 |
|
|
procedure Error_Msg_N (Msg : String; N : Node_Or_Entity_Id);
|
677 |
|
|
-- Output a message at the Sloc of the given node. This routine can be
|
678 |
|
|
-- called from the parser or the semantic analyzer, although the call from
|
679 |
|
|
-- the latter is much more common (and is the most usual way of generating
|
680 |
|
|
-- error messages from the analyzer). The message text may contain a
|
681 |
|
|
-- single & insertion, which will reference the given node. The message is
|
682 |
|
|
-- suppressed if the node N already has a message posted, or if it is a
|
683 |
|
|
-- warning and N is an entity node for which warnings are suppressed.
|
684 |
|
|
|
685 |
|
|
procedure Error_Msg_F (Msg : String; N : Node_Id);
|
686 |
|
|
-- Similar to Error_Msg_N except that the message is placed on the first
|
687 |
|
|
-- node of the construct N (First_Node (N)).
|
688 |
|
|
|
689 |
|
|
procedure Error_Msg_NE
|
690 |
|
|
(Msg : String;
|
691 |
|
|
N : Node_Or_Entity_Id;
|
692 |
|
|
E : Node_Or_Entity_Id);
|
693 |
|
|
-- Output a message at the Sloc of the given node N, with an insertion of
|
694 |
|
|
-- the name from the given entity node E. This is used by the semantic
|
695 |
|
|
-- routines, where this is a common error message situation. The Msg text
|
696 |
|
|
-- will contain a & or } as usual to mark the insertion point. This
|
697 |
|
|
-- routine can be called from the parser or the analyzer.
|
698 |
|
|
|
699 |
|
|
procedure Error_Msg_FE
|
700 |
|
|
(Msg : String;
|
701 |
|
|
N : Node_Id;
|
702 |
|
|
E : Node_Or_Entity_Id);
|
703 |
|
|
-- Same as Error_Msg_NE, except that the message is placed on the first
|
704 |
|
|
-- node of the construct N (First_Node (N)).
|
705 |
|
|
|
706 |
|
|
procedure Error_Msg_NEL
|
707 |
|
|
(Msg : String;
|
708 |
|
|
N : Node_Or_Entity_Id;
|
709 |
|
|
E : Node_Or_Entity_Id;
|
710 |
|
|
Flag_Location : Source_Ptr);
|
711 |
|
|
-- Exactly the same as Error_Msg_NE, except that the flag is placed at
|
712 |
|
|
-- the specified Flag_Location instead of at Sloc (N).
|
713 |
|
|
|
714 |
|
|
procedure Error_Msg_NW
|
715 |
|
|
(Eflag : Boolean;
|
716 |
|
|
Msg : String;
|
717 |
|
|
N : Node_Or_Entity_Id);
|
718 |
|
|
-- This routine is used for posting a message conditionally. The message
|
719 |
|
|
-- is posted (with the same effect as Error_Msg_N (Msg, N) if and only
|
720 |
|
|
-- if Eflag is True and if the node N is within the main extended source
|
721 |
|
|
-- unit and comes from source. Typically this is a warning mode flag.
|
722 |
|
|
-- This routine can only be called during semantic analysis. It may not
|
723 |
|
|
-- be called during parsing.
|
724 |
|
|
|
725 |
|
|
procedure Change_Error_Text (Error_Id : Error_Msg_Id; New_Msg : String);
|
726 |
|
|
-- The error message text of the message identified by Id is replaced by
|
727 |
|
|
-- the given text. This text may contain insertion characters in the
|
728 |
|
|
-- usual manner, and need not be the same length as the original text.
|
729 |
|
|
|
730 |
|
|
function First_Node (C : Node_Id) return Node_Id;
|
731 |
|
|
-- Given a construct C, finds the first node in the construct, i.e. the
|
732 |
|
|
-- one with the lowest Sloc value. This is useful in placing error msgs.
|
733 |
|
|
|
734 |
|
|
function First_Sloc (N : Node_Id) return Source_Ptr;
|
735 |
|
|
-- Given the node for an expression, return a source pointer value that
|
736 |
|
|
-- points to the start of the first token in the expression. In the case
|
737 |
|
|
-- where the expression is parenthesized, an attempt is made to include
|
738 |
|
|
-- the parentheses (i.e. to return the location of the initial paren).
|
739 |
|
|
|
740 |
|
|
procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr)
|
741 |
|
|
renames Erroutc.Purge_Messages;
|
742 |
|
|
-- All error messages whose location is in the range From .. To (not
|
743 |
|
|
-- including the end points) will be deleted from the error listing.
|
744 |
|
|
|
745 |
|
|
procedure Remove_Warning_Messages (N : Node_Id);
|
746 |
|
|
-- Remove any warning messages corresponding to the Sloc of N or any
|
747 |
|
|
-- of its descendent nodes. No effect if no such warnings. Note that
|
748 |
|
|
-- style messages (identified by the fact that they start with "(style)"
|
749 |
|
|
-- are not removed by this call. Basically the idea behind this procedure
|
750 |
|
|
-- is to remove warnings about execution conditions from known dead code.
|
751 |
|
|
|
752 |
|
|
procedure Remove_Warning_Messages (L : List_Id);
|
753 |
|
|
-- Remove warnings on all elements of a list (Calls Remove_Warning_Messages
|
754 |
|
|
-- on each element of the list, see above).
|
755 |
|
|
|
756 |
|
|
procedure Set_Ignore_Errors (To : Boolean);
|
757 |
|
|
-- Following a call to this procedure with To=True, all error calls are
|
758 |
|
|
-- ignored. A call with To=False restores the default treatment in which
|
759 |
|
|
-- error calls are treated as usual (and as described in this spec).
|
760 |
|
|
|
761 |
|
|
procedure Set_Warnings_Mode_Off (Loc : Source_Ptr)
|
762 |
|
|
renames Erroutc.Set_Warnings_Mode_Off;
|
763 |
|
|
-- Called in response to a pragma Warnings (Off) to record the source
|
764 |
|
|
-- location from which warnings are to be turned off.
|
765 |
|
|
|
766 |
|
|
procedure Set_Warnings_Mode_On (Loc : Source_Ptr)
|
767 |
|
|
renames Erroutc.Set_Warnings_Mode_On;
|
768 |
|
|
-- Called in response to a pragma Warnings (On) to record the source
|
769 |
|
|
-- location from which warnings are to be turned back on.
|
770 |
|
|
|
771 |
|
|
procedure Set_Specific_Warning_Off
|
772 |
|
|
(Loc : Source_Ptr;
|
773 |
|
|
Msg : String;
|
774 |
|
|
Config : Boolean;
|
775 |
|
|
Used : Boolean := False)
|
776 |
|
|
renames Erroutc.Set_Specific_Warning_Off;
|
777 |
|
|
-- This is called in response to the two argument form of pragma Warnings
|
778 |
|
|
-- where the first argument is OFF, and the second argument is the prefix
|
779 |
|
|
-- of a specific warning to be suppressed. The first argument is the start
|
780 |
|
|
-- of the suppression range, and the second argument is the string from
|
781 |
|
|
-- the pragma.
|
782 |
|
|
|
783 |
|
|
procedure Set_Specific_Warning_On
|
784 |
|
|
(Loc : Source_Ptr;
|
785 |
|
|
Msg : String;
|
786 |
|
|
Err : out Boolean)
|
787 |
|
|
renames Erroutc.Set_Specific_Warning_On;
|
788 |
|
|
-- This is called in response to the two argument form of pragma Warnings
|
789 |
|
|
-- where the first argument is ON, and the second argument is the prefix
|
790 |
|
|
-- of a specific warning to be suppressed. The first argument is the end
|
791 |
|
|
-- of the suppression range, and the second argument is the string from
|
792 |
|
|
-- the pragma. Err is set to True on return to report the error of no
|
793 |
|
|
-- matching Warnings Off pragma preceding this one.
|
794 |
|
|
|
795 |
|
|
function Compilation_Errors return Boolean;
|
796 |
|
|
-- Returns true if errors have been detected, or warnings in -gnatwe
|
797 |
|
|
-- (treat warnings as errors) mode. Note that it is mandatory to call
|
798 |
|
|
-- Finalize before calling this routine.
|
799 |
|
|
|
800 |
|
|
procedure Error_Msg_CRT (Feature : String; N : Node_Id);
|
801 |
|
|
-- Posts a non-fatal message on node N saying that the feature identified
|
802 |
|
|
-- by the Feature argument is not supported in either configurable
|
803 |
|
|
-- run-time mode or no run-time mode (as appropriate). In the former case,
|
804 |
|
|
-- the name of the library is output if available.
|
805 |
|
|
|
806 |
|
|
procedure Error_Msg_PT (Typ : Node_Id; Subp : Node_Id);
|
807 |
|
|
-- Posts an error on the protected type declaration Typ indicating wrong
|
808 |
|
|
-- mode of the first formal of protected type primitive Subp.
|
809 |
|
|
|
810 |
|
|
procedure dmsg (Id : Error_Msg_Id) renames Erroutc.dmsg;
|
811 |
|
|
-- Debugging routine to dump an error message
|
812 |
|
|
|
813 |
|
|
------------------------------------
|
814 |
|
|
-- Utility Interface for Back End --
|
815 |
|
|
------------------------------------
|
816 |
|
|
|
817 |
|
|
-- The following subprograms can be used by the back end for the purposes
|
818 |
|
|
-- of concocting error messages that are not output via Errout, e.g. the
|
819 |
|
|
-- messages generated by the gcc back end.
|
820 |
|
|
|
821 |
|
|
procedure Set_Identifier_Casing
|
822 |
|
|
(Identifier_Name : System.Address;
|
823 |
|
|
File_Name : System.Address);
|
824 |
|
|
-- The identifier is a null terminated string that represents the name of
|
825 |
|
|
-- an identifier appearing in the source program. File_Name is a null
|
826 |
|
|
-- terminated string giving the corresponding file name for the identifier
|
827 |
|
|
-- as obtained from the front end by the use of Full_Debug_Name to the
|
828 |
|
|
-- source file referenced by the corresponding source location value. On
|
829 |
|
|
-- return, the name is in Name_Buffer, null terminated with Name_Len set.
|
830 |
|
|
-- This name is the identifier name as passed, cased according to the
|
831 |
|
|
-- default identifier casing for the given file.
|
832 |
|
|
|
833 |
|
|
end Errout;
|