Add assember CFI directives to millicode division and remainder routines.
[official-gcc.git] / gcc / ada / erroutc.ads
blobc32b19ffe88e66652b1ead983cae13d8761993c7
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-2023, 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 ------------------------------------------------------------------------------
26 -- This package contains global variables and routines common to error
27 -- reporting packages, including Errout and Prj.Err.
29 with Table;
30 with Types; use Types;
32 package Erroutc is
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
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.
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.
47 Flag_Source : Source_File_Index;
48 -- Source file index for source file where error is being posted
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).
54 Has_Insertion_Line : Boolean := False;
55 -- Set True to indicate that the current message contains the insertion
56 -- character # (insert line number reference).
58 Is_Compile_Time_Msg : Boolean := False;
59 -- Set true to indicate that the current message originates from a
60 -- Compile_Time_Warning or Compile_Time_Error pragma.
62 Is_Serious_Error : Boolean := False;
63 -- Set True for a serious error (i.e. any message that is not a warning
64 -- or style message, and that does not contain a | insertion character).
66 Is_Unconditional_Msg : Boolean := False;
67 -- Set True to indicate that the current message contains the insertion
68 -- character ! and is thus to be treated as an unconditional message.
70 Is_Warning_Msg : Boolean := False;
71 -- Set True to indicate if current message is warning message (contains ?
72 -- or contains < and Error_Msg_Warn is True).
74 Is_Runtime_Raise : Boolean := False;
75 -- Set to True to indicate that the current message is a warning about a
76 -- constraint error that will be raised at runtime (contains [ and switch
77 -- -gnatwE was given).
79 Is_Info_Msg : Boolean := False;
80 -- Set True to indicate that the current message starts with the characters
81 -- "info: " and is to be treated as an information message. This string
82 -- will be prepended to the message and all its continuations.
84 Is_Check_Msg : Boolean := False;
85 -- Set True to indicate that the current message starts with one of
86 -- "high: ", "medium: ", "low: " and is to be treated as a check message.
88 Warning_Msg_Char : String (1 .. 2);
89 -- Warning switch, valid only if Is_Warning_Msg is True
90 -- " " -- ? or < appeared on its own in message
91 -- "? " -- ?? or << appeared in message
92 -- "x " -- ?x? or <x< appeared in message
93 -- -- (x = a .. z | A .. Z | * | $)
94 -- ".x" -- ?.x? appeared in message (x = a .. z | A .. Z)
95 -- "_x" -- ?_x? appeared in message (x = a .. z | A .. Z)
96 -- In the case of the < sequences, this is set only if the message is
97 -- actually a warning, i.e. if Error_Msg_Warn is True
99 Is_Style_Msg : Boolean := False;
100 -- Set True to indicate if the current message is a style message
101 -- (i.e. a message whose text starts with the characters "(style)").
103 Kill_Message : Boolean := False;
104 -- A flag used to kill weird messages (e.g. those containing uninterpreted
105 -- implicit type references) if we have already seen at least one message
106 -- already. The idea is that we hope the weird message is a junk cascaded
107 -- message that should be suppressed.
109 Last_Killed : Boolean := False;
110 -- Set True if the most recently posted non-continuation message was
111 -- killed. This is used to determine the processing of any continuation
112 -- messages that follow.
114 List_Pragmas_Index : Int := 0;
115 -- Index into List_Pragmas table
117 List_Pragmas_Mode : Boolean := False;
118 -- Starts True, gets set False by pragma List (Off), True by List (On)
120 Manual_Quote_Mode : Boolean := False;
121 -- Set True in manual quotation mode
123 Max_Msg_Length : constant := 1024 + 2 * Int (Column_Number'Last);
124 -- Maximum length of error message. The addition of 2 * Column_Number'Last
125 -- ensures that two insertion tokens of maximum length can be accommodated.
126 -- The value of 1024 is an arbitrary value that should be more than long
127 -- enough to accommodate any reasonable message (and for that matter, some
128 -- pretty unreasonable messages).
130 Msg_Buffer : String (1 .. Max_Msg_Length);
131 -- Buffer used to prepare error messages
133 Msglen : Integer := 0;
134 -- Number of characters currently stored in the message buffer
136 Suppress_Message : Boolean;
137 -- A flag used to suppress certain obviously redundant messages (i.e.
138 -- those referring to a node whose type is Any_Type). This suppression
139 -- is effective only if All_Errors_Mode is off.
141 Suppress_Instance_Location : Boolean := False;
142 -- Normally, if a # location in a message references a location within
143 -- a generic template, then a note is added giving the location of the
144 -- instantiation. If this variable is set True, then this note is not
145 -- output. This is used for internal processing for the case of an
146 -- illegal instantiation. See Error_Msg routine for further details.
148 type Subprogram_Name_Type is access function (N : Node_Id) return String;
149 Subprogram_Name_Ptr : Subprogram_Name_Type;
150 -- Indirect call to Sem_Util.Subprogram_Name to break circular
151 -- dependency with the static elaboration model.
153 ----------------------------
154 -- Message ID Definitions --
155 ----------------------------
157 type Error_Msg_Id is new Int;
158 -- A type used to represent specific error messages. Used by the clients
159 -- of this package only in the context of the Get_Error_Id and
160 -- Change_Error_Text subprograms.
162 No_Error_Msg : constant Error_Msg_Id := 0;
163 -- A constant which is different from any value returned by Get_Error_Id.
164 -- Typically used by a client to indicate absence of a saved Id value.
166 Cur_Msg : Error_Msg_Id := No_Error_Msg;
167 -- Id of most recently posted error message
169 function Get_Msg_Id return Error_Msg_Id;
170 -- Returns the Id of the message most recently posted using one of the
171 -- Error_Msg routines.
173 function Get_Location (E : Error_Msg_Id) return Source_Ptr;
174 -- Returns the flag location of the error message with the given id E
176 -----------------------------------
177 -- Error Message Data Structures --
178 -----------------------------------
180 -- The error messages are stored as a linked list of error message objects
181 -- sorted into ascending order by the source location (Sloc). Each object
182 -- records the text of the message and its source location.
184 -- The following record type and table are used to represent error
185 -- messages, with one entry in the table being allocated for each message.
187 type Error_Msg_Object is record
188 Text : String_Ptr;
189 -- Text of error message, fully expanded with all insertions
191 Next : Error_Msg_Id;
192 -- Pointer to next message in error chain. A value of No_Error_Msg
193 -- indicates the end of the chain.
195 Prev : Error_Msg_Id;
196 -- Pointer to previous message in error chain. Only set during the
197 -- Finalize procedure. A value of No_Error_Msg indicates the first
198 -- message in the chain.
200 Sfile : Source_File_Index;
201 -- Source table index of source file. In the case of an error that
202 -- refers to a template, always references the original template
203 -- not an instantiation copy.
205 Sptr : Source_Span;
206 -- Flag pointer. In the case of an error that refers to a template,
207 -- always references the original template, not an instantiation copy.
208 -- This value is the actual place in the source that the error message
209 -- will be posted. Note that an error placed on an instantiation will
210 -- have Sptr pointing to the instantiation point.
212 Optr : Source_Span;
213 -- Flag location used in the call to post the error. This is the same as
214 -- Sptr, except when an error is posted on a particular instantiation of
215 -- a generic. In such a case, Sptr will point to the original source
216 -- location of the instantiation itself, but Optr will point to the
217 -- template location (more accurately to the template copy in the
218 -- instantiation copy corresponding to the instantiation referenced by
219 -- Sptr).
221 Insertion_Sloc : Source_Ptr;
222 -- Location in message for insertion character # when used
224 Line : Physical_Line_Number;
225 -- Line number for error message
227 Col : Column_Number;
228 -- Column number for error message
230 Compile_Time_Pragma : Boolean;
231 -- True if the message originates from a Compile_Time_Warning or
232 -- Compile_Time_Error pragma
234 Warn : Boolean;
235 -- True if warning message
237 Info : Boolean;
238 -- True if info message
240 Check : Boolean;
241 -- True if check message
243 Warn_Err : Boolean;
244 -- True if this is a warning message which is to be treated as an error
245 -- as a result of a match with a Warning_As_Error pragma.
247 Warn_Runtime_Raise : Boolean;
248 -- True if this a warning about a constraint error that will be raised
249 -- at runtime.
251 Warn_Chr : String (1 .. 2);
252 -- See Warning_Msg_Char
254 Style : Boolean;
255 -- True if style message (starts with "(style)")
257 Serious : Boolean;
258 -- True if serious error message (not a warning and no | character)
260 Uncond : Boolean;
261 -- True if unconditional message (i.e. insertion character ! appeared)
263 Msg_Cont : Boolean;
264 -- This is used for logical messages that are composed of multiple
265 -- individual messages. For messages that are not part of such a
266 -- group, or that are the first message in such a group. Msg_Cont
267 -- is set to False. For subsequent messages in a group, Msg_Cont
268 -- is set to True. This is used to make sure that such a group of
269 -- messages is either suppressed or retained as a group (e.g. in
270 -- the circuit that deletes identical messages).
272 Deleted : Boolean;
273 -- If this flag is set, the message is not printed. This is used
274 -- in the circuit for deleting duplicate/redundant error messages.
276 Node : Node_Id;
277 -- If set, points to the node relevant for this message which will be
278 -- used to compute the enclosing subprogram name if
279 -- Opt.Include_Subprogram_In_Messages is set.
280 end record;
282 package Errors is new Table.Table (
283 Table_Component_Type => Error_Msg_Object,
284 Table_Index_Type => Error_Msg_Id,
285 Table_Low_Bound => 1,
286 Table_Initial => 200,
287 Table_Increment => 200,
288 Table_Name => "Error");
290 First_Error_Msg : Error_Msg_Id;
291 -- The list of error messages, i.e. the first entry on the list of error
292 -- messages. This is not the same as the physically first entry in the
293 -- error message table, since messages are not always inserted in sequence.
295 Last_Error_Msg : Error_Msg_Id;
296 -- The last entry on the list of error messages. Note: this is not the same
297 -- as the physically last entry in the error message table, since messages
298 -- are not always inserted in sequence.
300 --------------------------
301 -- Warning Mode Control --
302 --------------------------
304 -- Pragma Warnings allows warnings to be turned off for a specified region
305 -- of code, and the following tables are the data structures used to keep
306 -- track of these regions.
308 -- The first table is used for the basic command line control, and for the
309 -- forms of Warning with a single ON or OFF parameter.
311 -- It contains pairs of source locations, the first being the start
312 -- location for a warnings off region, and the second being the end
313 -- location. When a pragma Warnings (Off) is encountered, a new entry is
314 -- established extending from the location of the pragma to the end of the
315 -- current source file. A subsequent pragma Warnings (On) adjusts the end
316 -- point of this entry appropriately.
318 -- If all warnings are suppressed by command switch, then there is a dummy
319 -- entry (put there by Errout.Initialize) at the start of the table which
320 -- covers all possible Source_Ptr values. Note that the source pointer
321 -- values in this table always reference the original template, not an
322 -- instantiation copy, in the generic case.
324 -- Reason is the reason from the pragma Warnings (Off,..) or the null
325 -- string if no reason parameter is given.
327 type Warnings_Entry is record
328 Start : Source_Ptr;
329 Stop : Source_Ptr;
330 Reason : String_Id;
331 end record;
333 package Warnings is new Table.Table (
334 Table_Component_Type => Warnings_Entry,
335 Table_Index_Type => Natural,
336 Table_Low_Bound => 1,
337 Table_Initial => 100,
338 Table_Increment => 200,
339 Table_Name => "Warnings");
341 -- The second table is used for the specific forms of the pragma, where
342 -- the first argument is ON or OFF, and the second parameter is a string
343 -- which is the pattern to match for suppressing a warning.
345 type Specific_Warning_Entry is record
346 Start : Source_Ptr;
347 Stop : Source_Ptr;
348 -- Starting and ending source pointers for the range. These are always
349 -- from the same source file.
351 Reason : String_Id;
352 -- Reason string from pragma Warnings, or null string if none
354 Msg : String_Ptr;
355 -- Message from pragma Warnings (Off, string)
357 Open : Boolean;
358 -- Set to True if OFF has been encountered with no matching ON
360 Used : Boolean;
361 -- Set to True if entry has been used to suppress a warning
363 Config : Boolean;
364 -- True if pragma is configuration pragma (in which case no matching Off
365 -- pragma is required, and it is not required that a specific warning be
366 -- suppressed).
367 end record;
369 package Specific_Warnings is new Table.Table (
370 Table_Component_Type => Specific_Warning_Entry,
371 Table_Index_Type => Natural,
372 Table_Low_Bound => 1,
373 Table_Initial => 100,
374 Table_Increment => 200,
375 Table_Name => "Specific_Warnings");
377 -- Note on handling configuration case versus specific case. A complication
378 -- arises from this example:
380 -- pragma Warnings (Off, "not referenced*");
381 -- procedure Mumble (X : Integer) is
382 -- pragma Warnings (On, "not referenced*");
383 -- begin
384 -- null;
385 -- end Mumble;
387 -- The trouble is that the first pragma is technically a configuration
388 -- pragma, and yet it is clearly being used in the context of thinking of
389 -- it as a specific case. To deal with this, what we do is that the On
390 -- entry can match a configuration pragma from the same file, and if we
391 -- find such an On entry, we cancel the indication of it being the
392 -- configuration case. This seems to handle all cases we run into ok.
394 -------------------
395 -- Color Control --
396 -------------------
398 Use_SGR_Control : Boolean := False;
399 -- Set to True for enabling colored output. This should only be done when
400 -- outputting messages to a terminal that supports it.
402 -- Colors in messages output to a terminal are controlled using SGR
403 -- (Select Graphic Rendition).
405 Color_Separator : constant String := ";";
406 Color_None : constant String := "00";
407 Color_Bold : constant String := "01";
408 Color_Underscore : constant String := "04";
409 Color_Blink : constant String := "05";
410 Color_Reverse : constant String := "07";
411 Color_Fg_Black : constant String := "30";
412 Color_Fg_Red : constant String := "31";
413 Color_Fg_Green : constant String := "32";
414 Color_Fg_Yellow : constant String := "33";
415 Color_Fg_Blue : constant String := "34";
416 Color_Fg_Magenta : constant String := "35";
417 Color_Fg_Cyan : constant String := "36";
418 Color_Fg_White : constant String := "37";
419 Color_Bg_Black : constant String := "40";
420 Color_Bg_Red : constant String := "41";
421 Color_Bg_Green : constant String := "42";
422 Color_Bg_Yellow : constant String := "43";
423 Color_Bg_Blue : constant String := "44";
424 Color_Bg_Magenta : constant String := "45";
425 Color_Bg_Cyan : constant String := "46";
426 Color_Bg_White : constant String := "47";
428 SGR_Start : constant String := ASCII.ESC & "[";
429 SGR_End : constant String := "m" & ASCII.ESC & "[K";
431 function SGR_Seq (Str : String) return String is
432 (if Use_SGR_Control then SGR_Start & Str & SGR_End else "");
433 -- Return the SGR control string for the commands in Str. It returns the
434 -- empty string if Use_SGR_Control is False, so that we can insert this
435 -- string unconditionally.
437 function SGR_Reset return String is (SGR_Seq (""));
438 -- This ends the current section of colored output
440 -- We're using the same colors as gcc/g++ for errors/warnings/notes/locus.
441 -- More colors are defined in gcc/g++ for other features of diagnostic
442 -- messages (e.g. inline types, fixit) and could be used in GNAT in the
443 -- future. The following functions start a section of colored output.
445 function SGR_Error return String is
446 (SGR_Seq (Color_Bold & Color_Separator & Color_Fg_Red));
447 function SGR_Warning return String is
448 (SGR_Seq (Color_Bold & Color_Separator & Color_Fg_Magenta));
449 function SGR_Note return String is
450 (SGR_Seq (Color_Bold & Color_Separator & Color_Fg_Cyan));
451 function SGR_Locus return String is
452 (SGR_Seq (Color_Bold));
454 -----------------
455 -- Subprograms --
456 -----------------
458 procedure Add_Class;
459 -- Add 'Class to buffer for class wide type case (Class_Flag set)
461 function Buffer_Ends_With (C : Character) return Boolean;
462 -- Tests if message buffer ends with given character
464 function Buffer_Ends_With (S : String) return Boolean;
465 -- Tests if message buffer ends with given string preceded by a space
467 procedure Buffer_Remove (C : Character);
468 -- Remove given character from end of buffer if it is present
470 procedure Buffer_Remove (S : String);
471 -- Removes given string from end of buffer if it is present at end of
472 -- buffer, and preceded by a space.
474 function Compilation_Errors return Boolean;
475 -- Returns true if errors have been detected, or warnings in -gnatwe
476 -- (treat warnings as errors) mode.
478 procedure dmsg (Id : Error_Msg_Id);
479 -- Debugging routine to dump an error message
481 procedure Debug_Output (N : Node_Id);
482 -- Called from Error_Msg_N and Error_Msg_NE to generate line of debug
483 -- output giving node number (of node N) if the debug X switch is set.
485 procedure Check_Duplicate_Message (M1, M2 : Error_Msg_Id);
486 -- This function is passed the Id values of two error messages. If either
487 -- M1 or M2 is a continuation message, or is already deleted, the call is
488 -- ignored. Otherwise a check is made to see if M1 and M2 are duplicated or
489 -- redundant. If so, the message to be deleted and all its continuations
490 -- are marked with the Deleted flag set to True.
492 function Count_Compile_Time_Pragma_Warnings return Int;
493 -- Returns the number of warnings in the Errors table that were triggered
494 -- by a Compile_Time_Warning pragma.
496 function Get_Warning_Option (Id : Error_Msg_Id) return String;
497 -- Returns the warning switch causing this warning message or an empty
498 -- string is there is none..
500 function Get_Warning_Tag (Id : Error_Msg_Id) return String;
501 -- Given an error message ID, return tag showing warning message class, or
502 -- the null string if this option is not enabled or this is not a warning.
504 function Matches (S : String; P : String) return Boolean;
505 -- Returns true if the String S matches the pattern P, which can contain
506 -- wildcard chars (*). The entire pattern must match the entire string.
507 -- Case is ignored in the comparison (so X matches x).
509 procedure Output_Error_Msgs (E : in out Error_Msg_Id);
510 -- Output source line, error flag, and text of stored error message and all
511 -- subsequent messages for the same line and unit. On return E is set to be
512 -- one higher than the last message output.
514 procedure Output_Line_Number (L : Logical_Line_Number);
515 -- Output a line number as six digits (with leading zeroes suppressed),
516 -- followed by a period and a blank (note that this is 8 characters which
517 -- means that tabs in the source line will not get messed up). Line numbers
518 -- that match or are less than the last Source_Reference pragma are listed
519 -- as all blanks, avoiding output of junk line numbers.
521 procedure Output_Msg_Text (E : Error_Msg_Id);
522 -- Outputs characters of text in the text of the error message E. Note that
523 -- no end of line is output, the caller is responsible for adding the end
524 -- of line. If Error_Msg_Line_Length is non-zero, this is the routine that
525 -- splits the line generating multiple lines of output, and in this case
526 -- the last line has no terminating end of line character.
528 procedure Prescan_Message (Msg : String);
529 -- Scans message text and sets the following variables:
531 -- Is_Warning_Msg is set True if Msg is a warning message (contains a
532 -- question mark character), and False otherwise.
534 -- Is_Style_Msg is set True if Msg is a style message (starts with
535 -- "(style)") and False otherwise.
537 -- Is_Info_Msg is set True if Msg is an information message (starts
538 -- with "info: ". Such messages must contain a ? sequence since they
539 -- are also considered to be warning messages, and get a tag.
541 -- Is_Serious_Error is set to True unless the message is a warning or
542 -- style message or contains the character | (non-serious error).
544 -- Is_Unconditional_Msg is set True if the message contains the character
545 -- ! and is otherwise set False.
547 -- Has_Double_Exclam is set True if the message contains the sequence !!
548 -- and is otherwise set False.
550 -- Has_Insertion_Line is set True if the message contains the character #
551 -- and is otherwise set False.
553 -- We need to know right away these aspects of a message, since we will
554 -- test these values before doing the full error scan.
556 -- Note that the call has no effect for continuation messages (those whose
557 -- first character is '\'), and all variables are left unchanged, unless
558 -- -gnatdF is set.
560 procedure Purge_Messages (From : Source_Ptr; To : Source_Ptr);
561 -- All error messages whose location is in the range From .. To (not
562 -- including the end points) will be deleted from the error listing.
564 function Same_Error (M1, M2 : Error_Msg_Id) return Boolean;
565 -- See if two messages have the same text. Returns true if the text of the
566 -- two messages is identical, or if one of them is the same as the other
567 -- with an appended "instance at xxx" tag.
569 procedure Set_Msg_Blank;
570 -- Sets a single blank in the message if the preceding character is a
571 -- non-blank character other than a left parenthesis or minus. Has no
572 -- effect if manual quote mode is turned on.
574 procedure Set_Msg_Blank_Conditional;
575 -- Sets a single blank in the message if the preceding character is a
576 -- non-blank character other than a left parenthesis or quote. Has no
577 -- effect if manual quote mode is turned on.
579 procedure Set_Msg_Char (C : Character);
580 -- Add a single character to the current message. This routine does not
581 -- check for special insertion characters (they are just treated as text
582 -- characters if they occur).
584 procedure Set_Msg_Insertion_File_Name;
585 -- Handle file name insertion (left brace insertion character)
587 procedure Set_Msg_Insertion_Line_Number (Loc, Flag : Source_Ptr);
588 -- Handle line number insertion (# insertion character). Loc is the
589 -- location to be referenced, and Flag is the location at which the
590 -- flag is posted (used to determine whether to add "in file xxx")
592 procedure Set_Msg_Insertion_Name_Literal;
594 procedure Set_Msg_Insertion_Name;
595 -- Handle name insertion (% insertion character)
597 procedure Set_Msg_Insertion_Reserved_Name;
598 -- Handle insertion of reserved word name (* insertion character)
600 procedure Set_Msg_Insertion_Reserved_Word
601 (Text : String;
602 J : in out Integer);
603 -- Handle reserved word insertion (upper case letters). The Text argument
604 -- is the current error message input text, and J is an index which on
605 -- entry points to the first character of the reserved word, and on exit
606 -- points past the last character of the reserved word. Note that RM and
607 -- SPARK are treated specially and not considered to be keywords.
609 procedure Set_Msg_Insertion_Run_Time_Name;
610 -- If package System contains a definition for Run_Time_Name (see package
611 -- Targparm for details), then this procedure will insert a message of
612 -- the form (name) into the current error message, with name set in mixed
613 -- case (upper case after any spaces). If no run time name is defined,
614 -- then this routine has no effect).
616 procedure Set_Msg_Insertion_Uint;
617 -- Handle Uint insertion (^ insertion character)
619 procedure Set_Msg_Int (Line : Int);
620 -- Set the decimal representation of the argument in the error message
621 -- buffer with no leading zeroes output.
623 procedure Set_Msg_Name_Buffer;
624 -- Output name from Namet.Global_Name_Buffer, with surrounding quotes
625 -- unless manual quotation mode is in effect.
627 procedure Set_Msg_Quote;
628 -- Set quote if in normal quote mode, nothing if in manual quote mode
630 procedure Set_Msg_Str (Text : String);
631 -- Add a sequence of characters to the current message. This routine does
632 -- not check for special insertion characters (they are just treated as
633 -- text characters if they occur). It does perform the transformation of
634 -- the special strings _xxx (xxx = Pre/Post/Type_Invariant) to xxx'Class.
636 procedure Set_Next_Non_Deleted_Msg (E : in out Error_Msg_Id);
637 -- Given a message id, move to next message id, but skip any deleted
638 -- messages, so that this results in E on output being the first non-
639 -- deleted message following the input value of E, or No_Error_Msg if
640 -- the input value of E was either already No_Error_Msg, or was the
641 -- last non-deleted message.
643 procedure Set_Specific_Warning_Off
644 (Loc : Source_Ptr;
645 Msg : String;
646 Reason : String_Id;
647 Config : Boolean;
648 Used : Boolean := False);
649 -- This is called in response to the two argument form of pragma Warnings
650 -- where the first argument is OFF, and the second argument is a string
651 -- which identifies a specific warning to be suppressed. The first argument
652 -- is the start of the suppression range, and the second argument is the
653 -- string from the pragma. Loc is the location of the pragma (which is the
654 -- start of the range to suppress). Reason is the reason string from the
655 -- pragma, or the null string if no reason is given. Config is True for the
656 -- configuration pragma case (where there is no requirement for a matching
657 -- OFF pragma). Used is set True to disable the check that the warning
658 -- actually has the effect of suppressing a warning.
660 procedure Set_Specific_Warning_On
661 (Loc : Source_Ptr;
662 Msg : String;
663 Err : out Boolean);
664 -- This is called in response to the two argument form of pragma Warnings
665 -- where the first argument is ON, and the second argument is a string
666 -- which identifies a specific warning to be suppressed. The first argument
667 -- is the end of the suppression range, and the second argument is the
668 -- string from the pragma. Err is set to True on return to report the error
669 -- of no matching Warnings Off pragma preceding this one.
671 procedure Set_Warnings_Mode_Off (Loc : Source_Ptr; Reason : String_Id);
672 -- Called in response to a pragma Warnings (Off) to record the source
673 -- location from which warnings are to be turned off. Reason is the
674 -- Reason from the pragma, or the null string if none is given.
676 procedure Set_Warnings_Mode_On (Loc : Source_Ptr);
677 -- Called in response to a pragma Warnings (On) to record the source
678 -- location from which warnings are to be turned back on.
680 function Warnings_Suppressed (Loc : Source_Ptr) return String_Id;
681 -- Determines if given location is covered by a warnings off suppression
682 -- range in the warnings table (or is suppressed by compilation option,
683 -- which generates a warning range for the whole source file). This routine
684 -- only deals with the general ON/OFF case, not specific warnings. The
685 -- returned result is No_String if warnings are not suppressed. If warnings
686 -- are suppressed for the given location, then corresponding Reason
687 -- parameter from the pragma is returned (or the null string if no Reason
688 -- parameter was present).
690 function Warning_Specifically_Suppressed
691 (Loc : Source_Ptr;
692 Msg : String_Ptr;
693 Tag : String := "") return String_Id;
694 -- Determines if given message to be posted at given location is suppressed
695 -- by specific ON/OFF Warnings pragmas specifying this particular message.
696 -- If the warning is not suppressed then No_String is returned, otherwise
697 -- the corresponding warning string is returned (or the null string if no
698 -- Warning argument was present in the pragma). Tag is the error message
699 -- tag for the message in question or the null string if there is no tag.
701 -- Note: we have a null default for Tag to deal with calls from an old
702 -- branch of gnat2why, which does not know about tags in the calls but
703 -- which uses the latest version of erroutc.
705 function Warning_Treated_As_Error (Msg : String) return Boolean;
706 -- Returns True if the warning message Msg matches any of the strings
707 -- given by Warning_As_Error pragmas, as stored in the Warnings_As_Errors
708 -- table.
710 type Error_Msg_Proc is
711 access procedure (Msg : String; Flag_Location : Source_Ptr);
712 procedure Validate_Specific_Warnings (Eproc : Error_Msg_Proc);
713 -- Checks that specific warnings are consistent (for non-configuration
714 -- case, properly closed, and used). The argument is a pointer to the
715 -- Error_Msg procedure to be called if any inconsistencies are detected.
717 end Erroutc;