OSDN Git Service

gcc/ada/
[pf3gnuchains/gcc-fork.git] / gcc / ada / binderr.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              B I N D E R R                               --
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 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 for the binder
27 --  and also the routines for handling fatal error conditions in the binder.
28
29 with Namet; use Namet;
30 with Types; use Types;
31
32 package Binderr is
33
34    Errors_Detected : Int;
35    --  Number of errors detected so far
36
37    Warnings_Detected : Int;
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
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
57    --      always enclosed in quotes. A second % may appear in a single message
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.
60
61    --    Insertion character $ (Dollar: insert unit name from Names table)
62    --      The character & is replaced by the text for the unit name specified
63    --      by the Name_Id value stored in Error_Msg_Unit_1. The name is always
64    --      enclosed in quotes. A second & may appear in a single message in
65    --      which case it is similarly replaced by the name which is specified
66    --      by the Name_Id value stored in Error_Msg_Unit_2.
67
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
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
86    --  variables are set depending on the specific insertion characters used.
87
88    Error_Msg_Name_1 : Name_Id;
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
98
99    Error_Msg_Nat_1 : Nat;
100    Error_Msg_Nat_2 : Nat;
101    --  Integer values for # insertion characters in message
102
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
110    --  counts appropriately
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;