Debian Codegraph @

gcc/ada/err_vars.ads

raw
1 ------------------------------------------------------------------------------
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-2025, 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 -- Note on error counts (Serious_Errors_Detected, Total_Errors_Detected,
36 -- Warnings_Detected, Warning_Info_Messages, Report_Info_Messages). These
37 -- counts might more logically appear in this unit, but we place them
38 -- instead in atree.ads, because of licensing issues. We need to be able
39 -- to access these counts from units that have the more general licensing
40 -- conditions.
41
42 ----------------------------------
43 -- Error Message Mode Variables --
44 ----------------------------------
45
46 -- These variables control special error message modes. The initialized
47 -- values below give the normal default behavior, but they can be reset
48 -- by the caller to get different behavior as noted in the comments. These
49 -- variables are not reset by calls to the error message routines, so the
50 -- caller is responsible for resetting the default behavior after use.
51
52 Error_Msg_Qual_Level : Nat := 0;
53 -- Number of levels of qualification required for type name (see the
54 -- description of the } insertion character. Note that this value does
55 -- not get reset by any Error_Msg call, so the caller is responsible
56 -- for resetting it.
57
58 Current_Error_Source_File : Source_File_Index := No_Source_File;
59 -- Id of current messages. Used to post file name when unit changes. This
60 -- is initialized to Main_Source_File at the start of a compilation, which
61 -- means that no file names will be output unless there are errors in units
62 -- other than the main unit. However, if the main unit has a pragma
63 -- Source_Reference line, then this is initialized to No_Source_File,
64 -- to force an initial reference to the real source file name.
65
66 ----------------------------------------
67 -- Error Message Insertion Parameters --
68 ----------------------------------------
69
70 -- The error message routines work with strings that contain insertion
71 -- sequences that result in the insertion of variable data. The following
72 -- variables contain the required data. The procedure is to set one or more
73 -- of the following global variables to appropriate values before making a
74 -- call to one of the error message routines with a string containing the
75 -- insertion character to get the value inserted in an appropriate format.
76 --
77 -- Some of these are initialized below, because they are read before being
78 -- set by clients.
79 --
80 -- Would it be desirable to use arrays (with element renamings) here
81 -- instead of individual variables, at least for the Error_Msg_Name_N and
82 -- Error_Msg_Node_N ??? This would allow simplifying existing code in some
83 -- cases (see errout.adb).
84
85 Error_Msg_Col : Column_Number;
86 -- Column for @ insertion character in message
87
88 Error_Msg_Uint_1 : Uint;
89 Error_Msg_Uint_2 : Uint := No_Uint;
90 -- Uint values for ^ insertion characters in message
91
92 Error_Msg_Code_Digits : constant := 4;
93 Error_Msg_Code : Nat range 0 .. 10 ** Error_Msg_Code_Digits - 1;
94 -- Nat value for [] insertion sequence in message, where a value of zero
95 -- indicates the absence of an error code.
96
97 -- WARNING: There is a matching C declaration of these variables in fe.h
98
99 Error_Msg_Sloc : Source_Ptr := No_Location;
100 -- Source location for # insertion character in message
101
102 Error_Msg_Name_1 : Name_Id;
103 Error_Msg_Name_2 : Name_Id := No_Name;
104 Error_Msg_Name_3 : Name_Id := No_Name;
105 Error_Msg_Name_4 : Name_Id := No_Name;
106 Error_Msg_Name_5 : Name_Id := No_Name;
107 Error_Msg_Name_6 : Name_Id := No_Name;
108 -- Name_Id values for % insertion characters in message
109
110 Error_Msg_File_1 : File_Name_Type;
111 Error_Msg_File_2 : File_Name_Type := No_File;
112 Error_Msg_File_3 : File_Name_Type := No_File;
113 -- File_Name_Type values for { insertion characters in message
114
115 Error_Msg_Unit_1 : Unit_Name_Type;
116 Error_Msg_Unit_2 : Unit_Name_Type := No_Unit_Name;
117 -- Unit_Name_Type values for $ insertion characters in message
118
119 Error_Msg_Node_1 : Node_Id;
120 Error_Msg_Node_2 : Node_Id := Empty;
121 Error_Msg_Node_3 : Node_Id := Empty;
122 Error_Msg_Node_4 : Node_Id := Empty;
123 Error_Msg_Node_5 : Node_Id := Empty;
124 Error_Msg_Node_6 : Node_Id := Empty;
125 -- Node_Id values for & insertion characters in message
126
127 Error_Msg_Warn : Boolean;
128 -- Used if current message contains a < insertion character to indicate
129 -- if the current message is a warning message. Must be set appropriately
130 -- before any call to Error_Msg_xxx with a < insertion character present.
131 -- Setting is irrelevant if no < insertion character is present. Note
132 -- that it is not necessary to reset this after using it, since the proper
133 -- procedure is always to set it before issuing such a message. Note that
134 -- the warning documentation tag is always [enabled by default] in the
135 -- case where this flag is True.
136
137 Error_Msg_String : String (1 .. 4096);
138 Error_Msg_Strlen : Natural;
139 -- Used if current message contains a ~ insertion character to indicate
140 -- insertion of the string Error_Msg_String (1 .. Error_Msg_Strlen).
141
142 end Err_Vars;