]>
Commit | Line | Data |
---|---|---|
70482933 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT COMPILER COMPONENTS -- | |
4 | -- -- | |
5 | -- B I N D E R R -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
1d005acc | 9 | -- Copyright (C) 1992-2019, Free Software Foundation, Inc. -- |
70482933 RK |
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- -- | |
b5c84c3c | 13 | -- ware Foundation; either version 3, or (at your option) any later ver- -- |
70482933 RK |
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 -- | |
b5c84c3c RD |
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. -- | |
70482933 RK |
20 | -- -- |
21 | -- GNAT was originally developed by the GNAT team at New York University. -- | |
71ff80dc | 22 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
70482933 RK |
23 | -- -- |
24 | ------------------------------------------------------------------------------ | |
25 | ||
26 | -- This package contains the routines to output error messages for the binder | |
27 | -- and also the routines for handling fatal error conditions in the binder. | |
28 | ||
39f4e199 | 29 | with Namet; use Namet; |
70482933 RK |
30 | with Types; use Types; |
31 | ||
32 | package Binderr is | |
33 | ||
c63a2ad6 | 34 | Errors_Detected : Nat; |
70482933 RK |
35 | -- Number of errors detected so far |
36 | ||
c63a2ad6 | 37 | Warnings_Detected : Nat; |
70482933 RK |
38 | -- Number of warnings detected |
39 | ||
40 | Info_Prefix_Suppress : Boolean := False; | |
41 | -- If set to True, the normal "info: " header before messages generated | |
42 | -- by Error_Msg_Info will be omitted. | |
43 | ||
44 | --------------------------------------------------------- | |
45 | -- Error Message Text and Message Insertion Characters -- | |
46 | --------------------------------------------------------- | |
47 | ||
48 | -- Error message text strings are composed of letters, digits and the | |
49 | -- special characters space, comma, period, colon and semicolon, | |
50 | -- apostrophe and parentheses. Special insertion characters can also | |
51 | -- appear which cause the error message circuit to modify the given | |
52 | -- string as follows: | |
53 | ||
39f4e199 VC |
54 | -- Insertion character { (Left brace: insert file name from Names table) |
55 | -- The character { is replaced by the text for the file name specified | |
56 | -- by the File_Name_Type value stored in Error_Msg_File_1. The name is | |
f7f0159d | 57 | -- always enclosed in quotes. A second { may appear in a single message |
39f4e199 VC |
58 | -- in which case it is similarly replaced by the name which is |
59 | -- specified by the File_Name_Type value stored in Error_Msg_File_2. | |
70482933 | 60 | |
39f4e199 | 61 | -- Insertion character $ (Dollar: insert unit name from Names table) |
9d2a2071 | 62 | -- The character $ is replaced by the text for the unit name specified |
39f4e199 | 63 | -- by the Name_Id value stored in Error_Msg_Unit_1. The name is always |
f7f0159d | 64 | -- enclosed in quotes. A second $ may appear in a single message in |
70482933 | 65 | -- which case it is similarly replaced by the name which is specified |
39f4e199 | 66 | -- by the Name_Id value stored in Error_Msg_Unit_2. |
70482933 | 67 | |
bcea76b6 GB |
68 | -- Insertion character # (Pound: insert non-negative number in decimal) |
69 | -- The character # is replaced by the contents of Error_Msg_Nat_1 | |
70 | -- converted into an unsigned decimal string. A second # may appear | |
71 | -- in a single message, in which case it is similarly replaced by | |
72 | -- the value stored in Error_Msg_Nat_2. | |
73 | ||
70482933 RK |
74 | -- Insertion character ? (Question mark: warning message) |
75 | -- The character ?, which must be the first character in the message | |
76 | -- string, signals a warning message instead of an error message. | |
77 | ||
78 | ----------------------------------------------------- | |
79 | -- Global Values Used for Error Message Insertions -- | |
80 | ----------------------------------------------------- | |
81 | ||
82 | -- The following global variables are essentially additional parameters | |
83 | -- passed to the error message routine for insertion sequences described | |
84 | -- above. The reason these are passed globally is that the insertion | |
85 | -- mechanism is essentially an untyped one in which the appropriate | |
39f4e199 | 86 | -- variables are set depending on the specific insertion characters used. |
70482933 RK |
87 | |
88 | Error_Msg_Name_1 : Name_Id; | |
39f4e199 VC |
89 | -- Name_Id value for % insertion characters in message |
90 | ||
91 | Error_Msg_File_1 : File_Name_Type; | |
92 | Error_Msg_File_2 : File_Name_Type; | |
93 | -- Name_Id values for { insertion characters in message | |
94 | ||
95 | Error_Msg_Unit_1 : Unit_Name_Type; | |
96 | Error_Msg_Unit_2 : Unit_Name_Type; | |
97 | -- Name_Id values for $ insertion characters in message | |
70482933 | 98 | |
bcea76b6 GB |
99 | Error_Msg_Nat_1 : Nat; |
100 | Error_Msg_Nat_2 : Nat; | |
101 | -- Integer values for # insertion characters in message | |
102 | ||
70482933 RK |
103 | ------------------------------ |
104 | -- Error Output Subprograms -- | |
105 | ------------------------------ | |
106 | ||
107 | procedure Error_Msg (Msg : String); | |
108 | -- Output specified error message to standard error or standard output | |
109 | -- as governed by the brief and verbose switches, and update error | |
1ceee6a1 | 110 | -- counts appropriately. |
70482933 RK |
111 | |
112 | procedure Error_Msg_Info (Msg : String); | |
113 | -- Output information line. Indentical in effect to Error_Msg, except | |
114 | -- that the prefix is info: instead of error: and the error count is | |
115 | -- not incremented. The prefix may be suppressed by setting the global | |
116 | -- variable Info_Prefix_Suppress to True. | |
117 | ||
118 | procedure Error_Msg_Output (Msg : String; Info : Boolean); | |
119 | -- Output given message, with insertions, to current message output file. | |
120 | -- The second argument is True for an info message, false for a normal | |
121 | -- warning or error message. Normally this is not called directly, but | |
122 | -- rather only by Error_Msg or Error_Msg_Info. It is called directly | |
123 | -- when the caller must control whether the output goes to stderr or | |
124 | -- stdout (Error_Msg_Output always goes to the current output file). | |
125 | ||
126 | procedure Finalize_Binderr; | |
127 | -- Finalize error output for one file | |
128 | ||
129 | procedure Initialize_Binderr; | |
130 | -- Initialize error output for one file | |
131 | ||
132 | end Binderr; |