1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                              E R R O U T C                               --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 1992-2019, 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 packages contains global variables and routines common to error
27--  reporting packages, including Errout and Prj.Err.
28
29with Table;
30with Types; use Types;
31
32package Erroutc is
33
34   Class_Flag : Boolean := False;
35   --  This flag is set True when outputting a reference to a class-wide
36   --  type, and is used by Add_Class to insert 'Class at the proper point
37
38   Continuation : Boolean := False;
39   --  Indicates if current message is a continuation. Initialized from the
40   --  Msg_Cont parameter in Error_Msg_Internal and then set True if a \
41   --  insertion character is encountered.
42
43   Continuation_New_Line : Boolean := False;
44   --  Indicates if current message was a continuation line marked with \\ to
45   --  force a new line. Set True if \\ encountered.
46
47   Flag_Source : Source_File_Index;
48   --  Source file index for source file where error is being posted
49
50   Has_Double_Exclam : Boolean := False;
51   --  Set true to indicate that the current message contains the insertion
52   --  sequence !! (force warnings even in non-main unit source files).
53
54   Is_Serious_Error : Boolean := False;
55   --  Set True for a serious error (i.e. any message that is not a warning
56   --  or style message, and that does not contain a | insertion character).
57
58   Is_Unconditional_Msg : Boolean := False;
59   --  Set True to indicate that the current message contains the insertion
60   --  character ! and is thus to be treated as an unconditional message.
61
62   Is_Warning_Msg : Boolean := False;
63   --  Set True to indicate if current message is warning message (contains ?
64   --  or contains < and Error_Msg_Warn is True.
65
66   Is_Info_Msg : Boolean := False;
67   --  Set True to indicate that the current message starts with the characters
68   --  "info: " and is to be treated as an information message. This string
69   --  will be prepended to the message and all its continuations.
70
71   Is_Check_Msg : Boolean := False;
72   --  Set True to indicate that the current message starts with one of
73   --  "high: ", "medium: ", "low: " and is to be treated as a check message.
74
75   Warning_Msg_Char : Character;
76   --  Warning character, valid only if Is_Warning_Msg is True
77   --    ' '      -- ?   or <   appeared on its own in message
78   --    '?'      -- ??  or <<  appeared in message
79   --    'x'      -- ?x? or <x< appeared in message (x = a .. z)
80   --    'X'      -- ?X? or <X< appeared in message (X = A .. Z)
81   --    '*'      -- ?*? or <*< appeared in message
82   --    '$'      -- ?$? or <$< appeared in message
83   --  In the case of the < sequences, this is set only if the message is
84   --  actually a warning, i.e. if Error_Msg_Warn is True
85
86   Is_Style_Msg : Boolean := False;
87   --  Set True to indicate if the current message is a style message
88   --  (i.e. a message whose text starts with the characters "(style)").
89
90   Kill_Message : Boolean := False;
91   --  A flag used to kill weird messages (e.g. those containing uninterpreted
92   --  implicit type references) if we have already seen at least one message
93   --  already. The idea is that we hope the weird message is a junk cascaded
94   --  message that should be suppressed.
95
96   Last_Killed : Boolean := False;
97   --  Set True if the most recently posted non-continuation message was
98   --  killed. This is used to determine the processing of any continuation
99   --  messages that follow.
100
101   List_Pragmas_Index : Int := 0;
102   --  Index into List_Pragmas table
103
104   List_Pragmas_Mode : Boolean := False;
105   --  Starts True, gets set False by pragma List (Off), True by List (On)
106
107   Manual_Quote_Mode : Boolean := False;
108   --  Set True in manual quotation mode
109
110   Max_Msg_Length : constant := 1024 + 2 * Int (Column_Number'Last);
111   --  Maximum length of error message. The addition of 2 * Column_Number'Last
112   --  ensures that two insertion tokens of maximum length can be accommodated.
113   --  The value of 1024 is an arbitrary value that should be more than long
114   --  enough to accommodate any reasonable message (and for that matter, some
115   --  pretty unreasonable messages).
116
117   Msg_Buffer : String (1 .. Max_Msg_Length);
118   --  Buffer used to prepare error messages
119
120   Msglen : Integer := 0;
121   --  Number of characters currently stored in the message buffer
122
123   Suppress_Message : Boolean;
124   --  A flag used to suppress certain obviously redundant messages (i.e.
125   --  those referring to a node whose type is Any_Type). This suppression
126   --  is effective only if All_Errors_Mode is off.
127
128   Suppress_Instance_Location : Boolean := False;
129   --  Normally, if a # location in a message references a location within
130   --  a generic template, then a note is added giving the location of the
131   --  instantiation. If this variable is set True, then this note is not
132   --  output. This is used for internal processing for the case of an
133   --  illegal instantiation. See Error_Msg routine for further details.
134
135   type Subprogram_Name_Type is access function (N : Node_Id) return String;
136   Subprogram_Name_Ptr : Subprogram_Name_Type;
137   --  Indirect call to Sem_Util.Subprogram_Name to break circular
138   --  dependency with the static elaboration model.
139
140   ----------------------------
141   -- Message ID Definitions --
142   ----------------------------
143
144   type Error_Msg_Id is new Int;
145   --  A type used to represent specific error messages. Used by the clients
146   --  of this package only in the context of the Get_Error_Id and
147   --  Change_Error_Text subprograms.
148
149   No_Error_Msg : constant Error_Msg_Id := 0;
150   --  A constant which is different from any value returned by Get_Error_Id.
151   --  Typically used by a client to indicate absence of a saved Id value.
152
153   Cur_Msg : Error_Msg_Id := No_Error_Msg;
154   --  Id of most recently posted error message
155
156   function Get_Msg_Id return Error_Msg_Id;
157   --  Returns the Id of the message most recently posted using one of the
158   --  Error_Msg routines.
159
160   function Get_Location (E : Error_Msg_Id) return Source_Ptr;
161   --  Returns the flag location of the error message with the given id E
162
163   -----------------------------------
164   -- Error Message Data Structures --
165   -----------------------------------
166
167   --  The error messages are stored as a linked list of error message objects
168   --  sorted into ascending order by the source location (Sloc). Each object
169   --  records the text of the message and its source location.
170
171   --  The following record type and table are used to represent error
172   --  messages, with one entry in the table being allocated for each message.
173
174   type Error_Msg_Object is record
175      Text : String_Ptr;
176      --  Text of error message, fully expanded with all insertions
177
178      Next : Error_Msg_Id;
179      --  Pointer to next message in error chain. A value of No_Error_Msg
180      --  indicates the end of the chain.
181
182      Prev : Error_Msg_Id;
183      --  Pointer to previous message in error chain. Only set during the
184      --  Finalize procedure. A value of No_Error_Msg indicates the first
185      --  message in the chain.
186
187      Sfile : Source_File_Index;
188      --  Source table index of source file. In the case of an error that
189      --  refers to a template, always references the original template
190      --  not an instantiation copy.
191
192      Sptr : Source_Ptr;
193      --  Flag pointer. In the case of an error that refers to a template,
194      --  always references the original template, not an instantiation copy.
195      --  This value is the actual place in the source that the error message
196      --  will be posted. Note that an error placed on an instantiation will
197      --  have Sptr pointing to the instantiation point.
198
199      Optr : Source_Ptr;
200      --  Flag location used in the call to post the error. This is the same as
201      --  Sptr, except when an error is posted on a particular instantiation of
202      --  a generic. In such a case, Sptr will point to the original source
203      --  location of the instantiation itself, but Optr will point to the
204      --  template location (more accurately to the template copy in the
205      --  instantiation copy corresponding to the instantiation referenced by
206      --  Sptr).
207
208      Line : Physical_Line_Number;
209      --  Line number for error message
210
211      Col : Column_Number;
212      --  Column number for error message
213
214      Warn : Boolean;
215      --  True if warning message
216
217      Info : Boolean;
218      --  True if info message
219
220      Check : Boolean;
221      --  True if check message
222
223      Warn_Err : Boolean;
224      --  True if this is a warning message which is to be treated as an error
225      --  as a result of a match with a Warning_As_Error pragma.
226
227      Warn_Chr : Character;
228      --  Warning character (note: set even if Warning_Doc_Switch is False)
229      --    ' '      -- ?   or <   appeared on its own in message
230      --    '?'      -- ??  or <<  appeared in message
231      --    'x'      -- ?x? or <x< appeared in message (x = a .. z)
232      --    'X'      -- ?X? or <X< appeared in message (X = A .. Z)
233      --    '*'      -- ?*? or <*< appeared in message
234      --    '$'      -- ?$? or <$< appeared in message
235      --  In the case of the < sequences, this is set only if the message is
236      --  actually a warning, i.e. if Error_Msg_Warn is True
237
238      Style : Boolean;
239      --  True if style message (starts with "(style)")
240
241      Serious : Boolean;
242      --  True if serious error message (not a warning and no | character)
243
244      Uncond : Boolean;
245      --  True if unconditional message (i.e. insertion character ! appeared)
246
247      Msg_Cont : Boolean;
248      --  This is used for logical messages that are composed of multiple
249      --  individual messages. For messages that are not part of such a
250      --  group, or that are the first message in such a group. Msg_Cont
251      --  is set to False. For subsequent messages in a group, Msg_Cont
252      --  is set to True. This is used to make sure that such a group of
253      --  messages is either suppressed or retained as a group (e.g. in
254      --  the circuit that deletes identical messages).
255
256      Deleted : Boolean;
257      --  If this flag is set, the message is not printed. This is used
258      --  in the circuit for deleting duplicate/redundant error messages.
259
260      Node : Node_Id;
261      --  If set, points to the node relevant for this message which will be
262      --  used to compute the enclosing subprogram name if
263      --  Opt.Include_Subprogram_In_Messages is set.
264   end record;
265
266   package Errors is new Table.Table (
267     Table_Component_Type => Error_Msg_Object,
268     Table_Index_Type     => Error_Msg_Id,
269     Table_Low_Bound      => 1,
270     Table_Initial        => 200,
271     Table_Increment      => 200,
272     Table_Name           => "Error");
273
274   First_Error_Msg : Error_Msg_Id;
275   --  The list of error messages, i.e. the first entry on the list of error
276   --  messages. This is not the same as the physically first entry in the
277   --  error message table, since messages are not always inserted in sequence.
278
279   Last_Error_Msg : Error_Msg_Id;
280   --  The last entry on the list of error messages. Note: this is not the same
281   --  as the physically last entry in the error message table, since messages
282   --  are not always inserted in sequence.
283
284   --------------------------
285   -- Warning Mode Control --
286   --------------------------
287
288   --  Pragma Warnings allows warnings to be turned off for a specified region
289   --  of code, and the following tables are the data structures used to keep
290   --  track of these regions.
291
292   --  The first table is used for the basic command line control, and for the
293   --  forms of Warning with a single ON or OFF parameter.
294
295   --  It contains pairs of source locations, the first being the start
296   --  location for a warnings off region, and the second being the end
297   --  location. When a pragma Warnings (Off) is encountered, a new entry is
298   --  established extending from the location of the pragma to the end of the
299   --  current source file. A subsequent pragma Warnings (On) adjusts the end
300   --  point of this entry appropriately.
301
302   --  If all warnings are suppressed by command switch, then there is a dummy
303   --  entry (put there by Errout.Initialize) at the start of the table which
304   --  covers all possible Source_Ptr values. Note that the source pointer
305   --  values in this table always reference the original template, not an
306   --  instantiation copy, in the generic case.
307
308   --  Reason is the reason from the pragma Warnings (Off,..) or the null
309   --  string if no reason parameter is given.
310
311   type Warnings_Entry is record
312      Start  : Source_Ptr;
313      Stop   : Source_Ptr;
314      Reason : String_Id;
315   end record;
316
317   package Warnings is new Table.Table (
318     Table_Component_Type => Warnings_Entry,
319     Table_Index_Type     => Natural,
320     Table_Low_Bound      => 1,
321     Table_Initial        => 100,
322     Table_Increment      => 200,
323     Table_Name           => "Warnings");
324
325   --  The second table is used for the specific forms of the pragma, where
326   --  the first argument is ON or OFF, and the second parameter is a string
327   --  which is the pattern to match for suppressing a warning.
328
329   type Specific_Warning_Entry is record
330      Start : Source_Ptr;
331      Stop  : Source_Ptr;
332      --  Starting and ending source pointers for the range. These are always
333      --  from the same source file.
334
335      Reason : String_Id;
336      --  Reason string from pragma Warnings, or null string if none
337
338      Msg : String_Ptr;
339      --  Message from pragma Warnings (Off, string)
340
341      Open : Boolean;
342      --  Set to True if OFF has been encountered with no matching ON
343
344      Used : Boolean;
345      --  Set to True if entry has been used to suppress a warning
346
347      Config : Boolean;
348      --  True if pragma is configuration pragma (in which case no matching Off
349      --  pragma is required, and it is not required that a specific warning be
350      --  suppressed).
351   end record;
352
353   package Specific_Warnings is new Table.Table (
354     Table_Component_Type => Specific_Warning_Entry,
355     Table_Index_Type     => Natural,
356     Table_Low_Bound      => 1,
357     Table_Initial        => 100,
358     Table_Increment      => 200,
359     Table_Name           => "Specific_Warnings");
360
361   --  Note on handling configuration case versus specific case. A complication
362   --  arises from this example:
363
364   --     pragma Warnings (Off, "not referenced*");
365   --     procedure Mumble (X : Integer) is
366   --     pragma Warnings (On, "not referenced*");
367   --     begin
368   --        null;
369   --     end Mumble;
370
371   --  The trouble is that the first pragma is technically a configuration
372   --  pragma, and yet it is clearly being used in the context of thinking of
373   --  it as a specific case. To deal with this, what we do is that the On
374   --  entry can match a configuration pragma from the same file, and if we
375   --  find such an On entry, we cancel the indication of it being the
376   --  configuration case. This seems to handle all cases we run into ok.
377
378   -----------------
379   -- Subprograms --
380   -----------------
381
382   procedure Add_Class;
383   --  Add 'Class to buffer for class wide type case (Class_Flag set)
384
385   function Buffer_Ends_With (C : Character) return Boolean;
386   --  Tests if message buffer ends with given character
387
388   function Buffer_Ends_With (S : String) return Boolean;
389   --  Tests if message buffer ends with given string preceded by a space
390
391   procedure Buffer_Remove (C : Character);
392   --  Remove given character fron end of buffer if it is present
393
394   procedure Buffer_Remove (S : String);
395   --  Removes given string from end of buffer if it is present at end of
396   --  buffer, and preceded by a space.
397
398   function Compilation_Errors return Boolean;
399   --  Returns true if errors have been detected, or warnings in -gnatwe
400   --  (treat warnings as errors) mode.
401
402   procedure dmsg (Id : Error_Msg_Id);
403   --  Debugging routine to dump an error message
404
405   procedure Debug_Output (N : Node_Id);
406   --  Called from Error_Msg_N and Error_Msg_NE to generate line of debug
407   --  output giving node number (of node N) if the debug X switch is set.
408
409   procedure Check_Duplicate_Message (M1, M2 : Error_Msg_Id);
410   --  This function is passed the Id values of two error messages. If either
411   --  M1 or M2 is a continuation message, or is already deleted, the call is
412   --  ignored. Otherwise a check is made to see if M1 and M2 are duplicated or
413   --  redundant. If so, the message to be deleted and all its continuations
414   --  are marked with the Deleted flag set to True.
415
416   function Get_Warning_Tag (Id : Error_Msg_Id) return String;
417   --  Given an error message ID, return tag showing warning message class, or
418   --  the null string if this option is not enabled or this is not a warning.
419
420   procedure Output_Error_Msgs (E : in out Error_Msg_Id);
421   --  Output source line, error flag, and text of stored error message and all
422   --  subsequent messages for the same line and unit. On return E is set to be
423   --  one higher than the last message output.
424
425   procedure Output_Line_Number (L : Logical_Line_Number);
426   --  Output a line number as six digits (with leading zeroes suppressed),
427   --  followed by a period and a blank (note that this is 8 characters which
428   --  means that tabs in the source line will not get messed up). Line numbers
429   --  that match or are less than the last Source_Reference pragma are listed
430   --  as all blanks, avoiding output of junk line numbers.
431
432   procedure Output_Msg_Text (E : Error_Msg_Id);
433   --  Outputs characters of text in the text of the error message E. Note that
434   --  no end of line is output, the caller is responsible for adding the end
435   --  of line. If Error_Msg_Line_Length is non-zero, this is the routine that
436   --  splits the line generating multiple lines of output, and in this case
437   --  the last line has no terminating end of line character.
438
439   procedure Prescan_Message (Msg : String);
440   --  Scans message text and sets the following variables:
441   --
442   --    Is_Warning_Msg is set True if Msg is a warning message (contains a
443   --    question mark character), and False otherwise.
444   --
445   --    Is_Style_Msg is set True if Msg is a style message (starts with
446   --    "(style)") and False otherwise.
447   --
448   --    Is_Info_Msg is set True if Msg is an information message (starts
449   --    with "info: ". Such messages must contain a ? sequence since they
450   --    are also considered to be warning messages, and get a tag.
451   --
452   --    Is_Serious_Error is set to True unless the message is a warning or
453   --    style message or contains the character | (non-serious error).
454   --
455   --    Is_Unconditional_Msg is set True if the message contains the character
456   --    ! and is otherwise set False.
457   --
458   --    Has_Double_Exclam is set True if the message contains the sequence !!
459   --    and is otherwise set False.
460   --
461   --  We need to know right away these aspects of a message, since we will
462   --  test these values before doing the full error scan.
463   --
464   --  Note that the call has no effect for continuation messages (those whose
465   --  first character is '\'), and all variables are left unchanged.
466
467   procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr);
468   --  All error messages whose location is in the range From .. To (not
469   --  including the end points) will be deleted from the error listing.
470
471   function Same_Error (M1, M2 : Error_Msg_Id) return Boolean;
472   --  See if two messages have the same text. Returns true if the text of the
473   --  two messages is identical, or if one of them is the same as the other
474   --  with an appended "instance at xxx" tag.
475
476   procedure Set_Msg_Blank;
477   --  Sets a single blank in the message if the preceding character is a
478   --  non-blank character other than a left parenthesis or minus. Has no
479   --  effect if manual quote mode is turned on.
480
481   procedure Set_Msg_Blank_Conditional;
482   --  Sets a single blank in the message if the preceding character is a
483   --  non-blank character other than a left parenthesis or quote. Has no
484   --  effect if manual quote mode is turned on.
485
486   procedure Set_Msg_Char (C : Character);
487   --  Add a single character to the current message. This routine does not
488   --  check for special insertion characters (they are just treated as text
489   --  characters if they occur).
490
491   procedure Set_Msg_Insertion_File_Name;
492   --  Handle file name insertion (left brace insertion character)
493
494   procedure Set_Msg_Insertion_Line_Number (Loc, Flag : Source_Ptr);
495   --  Handle line number insertion (# insertion character). Loc is the
496   --  location to be referenced, and Flag is the location at which the
497   --  flag is posted (used to determine whether to add "in file xxx")
498
499   procedure Set_Msg_Insertion_Name_Literal;
500
501   procedure Set_Msg_Insertion_Name;
502   --  Handle name insertion (% insertion character)
503
504   procedure Set_Msg_Insertion_Reserved_Name;
505   --  Handle insertion of reserved word name (* insertion character)
506
507   procedure Set_Msg_Insertion_Reserved_Word
508     (Text : String;
509      J    : in out Integer);
510   --  Handle reserved word insertion (upper case letters). The Text argument
511   --  is the current error message input text, and J is an index which on
512   --  entry points to the first character of the reserved word, and on exit
513   --  points past the last character of the reserved word. Note that RM and
514   --  SPARK are treated specially and not considered to be keywords.
515
516   procedure Set_Msg_Insertion_Run_Time_Name;
517   --  If package System contains a definition for Run_Time_Name (see package
518   --  Targparm for details), then this procedure will insert a message of
519   --  the form (name) into the current error message, with name set in mixed
520   --  case (upper case after any spaces). If no run time name is defined,
521   --  then this routine has no effect).
522
523   procedure Set_Msg_Insertion_Uint;
524   --  Handle Uint insertion (^ insertion character)
525
526   procedure Set_Msg_Int (Line : Int);
527   --  Set the decimal representation of the argument in the error message
528   --  buffer with no leading zeroes output.
529
530   procedure Set_Msg_Name_Buffer;
531   --  Output name from Name_Buffer, with surrounding quotes unless manual
532   --  quotation mode is in effect.
533
534   procedure Set_Msg_Quote;
535   --  Set quote if in normal quote mode, nothing if in manual quote mode
536
537   procedure Set_Msg_Str (Text : String);
538   --  Add a sequence of characters to the current message. This routine does
539   --  not check for special insertion characters (they are just treated as
540   --  text characters if they occur). It does perform the transformation of
541   --  the special strings _xxx (xxx = Pre/Post/Type_Invariant) to xxx'Class.
542
543   procedure Set_Next_Non_Deleted_Msg (E : in out Error_Msg_Id);
544   --  Given a message id, move to next message id, but skip any deleted
545   --  messages, so that this results in E on output being the first non-
546   --  deleted message following the input value of E, or No_Error_Msg if
547   --  the input value of E was either already No_Error_Msg, or was the
548   --  last non-deleted message.
549
550   procedure Set_Specific_Warning_Off
551     (Loc    : Source_Ptr;
552      Msg    : String;
553      Reason : String_Id;
554      Config : Boolean;
555      Used   : Boolean := False);
556   --  This is called in response to the two argument form of pragma Warnings
557   --  where the first argument is OFF, and the second argument is a string
558   --  which identifies a specific warning to be suppressed. The first argument
559   --  is the start of the suppression range, and the second argument is the
560   --  string from the pragma. Loc is the location of the pragma (which is the
561   --  start of the range to suppress). Reason is the reason string from the
562   --  pragma, or the null string if no reason is given. Config is True for the
563   --  configuration pragma case (where there is no requirement for a matching
564   --  OFF pragma). Used is set True to disable the check that the warning
565   --  actually has the effect of suppressing a warning.
566
567   procedure Set_Specific_Warning_On
568     (Loc : Source_Ptr;
569      Msg : String;
570      Err : out Boolean);
571   --  This is called in response to the two argument form of pragma Warnings
572   --  where the first argument is ON, and the second argument is a string
573   --  which identifies a specific warning to be suppressed. The first argument
574   --  is the end of the suppression range, and the second argument is the
575   --  string from the pragma. Err is set to True on return to report the error
576   --  of no matching Warnings Off pragma preceding this one.
577
578   procedure Set_Warnings_Mode_Off (Loc : Source_Ptr; Reason : String_Id);
579   --  Called in response to a pragma Warnings (Off) to record the source
580   --  location from which warnings are to be turned off. Reason is the
581   --  Reason from the pragma, or the null string if none is given.
582
583   procedure Set_Warnings_Mode_On (Loc : Source_Ptr);
584   --  Called in response to a pragma Warnings (On) to record the source
585   --  location from which warnings are to be turned back on.
586
587   function Warnings_Suppressed (Loc : Source_Ptr) return String_Id;
588   --  Determines if given location is covered by a warnings off suppression
589   --  range in the warnings table (or is suppressed by compilation option,
590   --  which generates a warning range for the whole source file). This routine
591   --  only deals with the general ON/OFF case, not specific warnings. The
592   --  returned result is No_String if warnings are not suppressed. If warnings
593   --  are suppressed for the given location, then corresponding Reason
594   --  parameter from the pragma is returned (or the null string if no Reason
595   --  parameter was present).
596
597   function Warning_Specifically_Suppressed
598     (Loc : Source_Ptr;
599      Msg : String_Ptr;
600      Tag : String := "") return String_Id;
601   --  Determines if given message to be posted at given location is suppressed
602   --  by specific ON/OFF Warnings pragmas specifying this particular message.
603   --  If the warning is not suppressed then No_String is returned, otherwise
604   --  the corresponding warning string is returned (or the null string if no
605   --  Warning argument was present in the pragma). Tag is the error message
606   --  tag for the message in question or the null string if there is no tag.
607   --
608   --  Note: we have a null default for Tag to deal with calls from an old
609   --  branch of gnat2why, which does not know about tags in the calls but
610   --  which uses the latest version of erroutc.
611
612   function Warning_Treated_As_Error (Msg : String) return Boolean;
613   --  Returns True if the warning message Msg matches any of the strings
614   --  given by Warning_As_Error pragmas, as stored in the Warnings_As_Errors
615   --  table.
616
617   type Error_Msg_Proc is
618     access procedure (Msg : String; Flag_Location : Source_Ptr);
619   procedure Validate_Specific_Warnings (Eproc : Error_Msg_Proc);
620   --  Checks that specific warnings are consistent (for non-configuration
621   --  case, properly closed, and used). The argument is a pointer to the
622   --  Error_Msg procedure to be called if any inconsistencies are detected.
623
624end Erroutc;
625