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