1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 ------------------------------------------------------------------------------
28 -- This package contains the routines to output error messages for the binder
29 -- and also the routines for handling fatal error conditions in the binder.
31 with Types; use Types;
35 Errors_Detected : Int;
36 -- Number of errors detected so far
38 Warnings_Detected : Int;
39 -- Number of warnings detected
41 Info_Prefix_Suppress : Boolean := False;
42 -- If set to True, the normal "info: " header before messages generated
43 -- by Error_Msg_Info will be omitted.
45 ---------------------------------------------------------
46 -- Error Message Text and Message Insertion Characters --
47 ---------------------------------------------------------
49 -- Error message text strings are composed of letters, digits and the
50 -- special characters space, comma, period, colon and semicolon,
51 -- apostrophe and parentheses. Special insertion characters can also
52 -- appear which cause the error message circuit to modify the given
55 -- Insertion character % (Percent: insert file name from Names table)
56 -- The character % is replaced by the text for the file name specified
57 -- by the Name_Id value stored in Error_Msg_Name_1. The name is always
58 -- enclosed in quotes. A second % may appear in a single message in
59 -- which case it is similarly replaced by the name which is specified
60 -- by the Name_Id value stored in Error_Msg_Name_2.
62 -- Insertion character & (Ampersand: insert unit name from Names table)
63 -- The character & is replaced by the text for the unit name specified
64 -- by the Name_Id value stored in Error_Msg_Name_1. The name is always
65 -- enclosed in quotes. A second & may appear in a single message in
66 -- which case it is similarly replaced by the name which is specified
67 -- by the Name_Id value stored in Error_Msg_Name_2.
69 -- Insertion character ? (Question mark: warning message)
70 -- The character ?, which must be the first character in the message
71 -- string, signals a warning message instead of an error message.
73 -----------------------------------------------------
74 -- Global Values Used for Error Message Insertions --
75 -----------------------------------------------------
77 -- The following global variables are essentially additional parameters
78 -- passed to the error message routine for insertion sequences described
79 -- above. The reason these are passed globally is that the insertion
80 -- mechanism is essentially an untyped one in which the appropriate
81 -- variables are set dependingon the specific insertion characters used.
83 Error_Msg_Name_1 : Name_Id;
84 Error_Msg_Name_2 : Name_Id;
85 -- Name_Id values for % insertion characters in message
87 ------------------------------
88 -- Error Output Subprograms --
89 ------------------------------
91 procedure Error_Msg (Msg : String);
92 -- Output specified error message to standard error or standard output
93 -- as governed by the brief and verbose switches, and update error
94 -- counts appropriately
96 procedure Error_Msg_Info (Msg : String);
97 -- Output information line. Indentical in effect to Error_Msg, except
98 -- that the prefix is info: instead of error: and the error count is
99 -- not incremented. The prefix may be suppressed by setting the global
100 -- variable Info_Prefix_Suppress to True.
102 procedure Error_Msg_Output (Msg : String; Info : Boolean);
103 -- Output given message, with insertions, to current message output file.
104 -- The second argument is True for an info message, false for a normal
105 -- warning or error message. Normally this is not called directly, but
106 -- rather only by Error_Msg or Error_Msg_Info. It is called directly
107 -- when the caller must control whether the output goes to stderr or
108 -- stdout (Error_Msg_Output always goes to the current output file).
110 procedure Finalize_Binderr;
111 -- Finalize error output for one file
113 procedure Initialize_Binderr;
114 -- Initialize error output for one file