File : erroutc.ads


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