1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- Warning! Error messages can be generated during Gigi processing by direct
28 -- calls to error message routines, so it is essential that the processing
29 -- in this body be consistent with the requirements for the Gigi processing
30 -- environment, and that in particular, no disallowed table expansion is
33 with Casing
; use Casing
;
34 with Debug
; use Debug
;
35 with Err_Vars
; use Err_Vars
;
36 with Namet
; use Namet
;
38 with Output
; use Output
;
39 with Sinput
; use Sinput
;
40 with Snames
; use Snames
;
41 with Targparm
; use Targparm
;
42 with Uintp
; use Uintp
;
44 package body Erroutc
is
46 -----------------------
47 -- Local Subprograms --
48 -----------------------
54 procedure Add_Class
is
59 Get_Name_String
(Name_Class
);
60 Set_Casing
(Identifier_Casing
(Flag_Source
), Mixed_Case
);
65 ----------------------
66 -- Buffer_Ends_With --
67 ----------------------
69 function Buffer_Ends_With
(S
: String) return Boolean is
70 Len
: constant Natural := S
'Length;
74 and then Msg_Buffer
(Msglen
- Len
) = ' '
75 and then Msg_Buffer
(Msglen
- Len
+ 1 .. Msglen
) = S
;
82 procedure Buffer_Remove
(S
: String) is
84 if Buffer_Ends_With
(S
) then
85 Msglen
:= Msglen
- S
'Length;
89 -----------------------------
90 -- Check_Duplicate_Message --
91 -----------------------------
93 procedure Check_Duplicate_Message
(M1
, M2
: Error_Msg_Id
) is
94 L1
, L2
: Error_Msg_Id
;
95 N1
, N2
: Error_Msg_Id
;
97 procedure Delete_Msg
(Delete
, Keep
: Error_Msg_Id
);
98 -- Called to delete message Delete, keeping message Keep. Marks
99 -- all messages of Delete with deleted flag set to True, and also
100 -- makes sure that for the error messages that are retained the
101 -- preferred message is the one retained (we prefer the shorter
102 -- one in the case where one has an Instance tag). Note that we
103 -- always know that Keep has at least as many continuations as
104 -- Delete (since we always delete the shorter sequence).
110 procedure Delete_Msg
(Delete
, Keep
: Error_Msg_Id
) is
118 Errors
.Table
(D
).Deleted
:= True;
120 -- Adjust error message count
122 if Errors
.Table
(D
).Warn
or Errors
.Table
(D
).Style
then
123 Warnings_Detected
:= Warnings_Detected
- 1;
125 Total_Errors_Detected
:= Total_Errors_Detected
- 1;
127 if Errors
.Table
(D
).Serious
then
128 Serious_Errors_Detected
:= Serious_Errors_Detected
- 1;
132 -- Substitute shorter of the two error messages
134 if Errors
.Table
(K
).Text
'Length > Errors
.Table
(D
).Text
'Length then
135 Errors
.Table
(K
).Text
:= Errors
.Table
(D
).Text
;
138 D
:= Errors
.Table
(D
).Next
;
139 K
:= Errors
.Table
(K
).Next
;
141 if D
= No_Error_Msg
or else not Errors
.Table
(D
).Msg_Cont
then
147 -- Start of processing for Check_Duplicate_Message
150 -- Both messages must be non-continuation messages and not deleted
152 if Errors
.Table
(M1
).Msg_Cont
153 or else Errors
.Table
(M2
).Msg_Cont
154 or else Errors
.Table
(M1
).Deleted
155 or else Errors
.Table
(M2
).Deleted
160 -- Definitely not equal if message text does not match
162 if not Same_Error
(M1
, M2
) then
166 -- Same text. See if all continuations are also identical
172 N1
:= Errors
.Table
(L1
).Next
;
173 N2
:= Errors
.Table
(L2
).Next
;
175 -- If M1 continuations have run out, we delete M1, either the
176 -- messages have the same number of continuations, or M2 has
177 -- more and we prefer the one with more anyway.
179 if N1
= No_Error_Msg
or else not Errors
.Table
(N1
).Msg_Cont
then
183 -- If M2 continuatins have run out, we delete M2
185 elsif N2
= No_Error_Msg
or else not Errors
.Table
(N2
).Msg_Cont
then
189 -- Otherwise see if continuations are the same, if not, keep both
190 -- sequences, a curious case, but better to keep everything!
192 elsif not Same_Error
(N1
, N2
) then
195 -- If continuations are the same, continue scan
202 end Check_Duplicate_Message
;
204 ------------------------
205 -- Compilation_Errors --
206 ------------------------
208 function Compilation_Errors
return Boolean is
210 return Total_Errors_Detected
/= 0
211 or else (Warnings_Detected
/= 0
212 and then Warning_Mode
= Treat_As_Error
);
213 end Compilation_Errors
;
219 procedure Debug_Output
(N
: Node_Id
) is
222 Write_Str
("*** following error message posted on node id = #");
233 procedure dmsg
(Id
: Error_Msg_Id
) is
234 E
: Error_Msg_Object
renames Errors
.Table
(Id
);
237 w
("Dumping error message, Id = ", Int
(Id
));
238 w
(" Text = ", E
.Text
.all);
239 w
(" Next = ", Int
(E
.Next
));
240 w
(" Sfile = ", Int
(E
.Sfile
));
244 Write_Location
(E
.Sptr
);
249 Write_Location
(E
.Optr
);
252 w
(" Line = ", Int
(E
.Line
));
253 w
(" Col = ", Int
(E
.Col
));
254 w
(" Warn = ", E
.Warn
);
255 w
(" Style = ", E
.Style
);
256 w
(" Serious = ", E
.Serious
);
257 w
(" Uncond = ", E
.Uncond
);
258 w
(" Msg_Cont = ", E
.Msg_Cont
);
259 w
(" Deleted = ", E
.Deleted
);
268 function Get_Location
(E
: Error_Msg_Id
) return Source_Ptr
is
270 return Errors
.Table
(E
).Sptr
;
277 function Get_Msg_Id
return Error_Msg_Id
is
282 -----------------------
283 -- Output_Error_Msgs --
284 -----------------------
286 procedure Output_Error_Msgs
(E
: in out Error_Msg_Id
) is
292 Mult_Flags
: Boolean := False;
297 -- Skip deleted messages at start
299 if Errors
.Table
(S
).Deleted
then
300 Set_Next_Non_Deleted_Msg
(S
);
303 -- Figure out if we will place more than one error flag on this line
306 while T
/= No_Error_Msg
307 and then Errors
.Table
(T
).Line
= Errors
.Table
(E
).Line
308 and then Errors
.Table
(T
).Sfile
= Errors
.Table
(E
).Sfile
310 if Errors
.Table
(T
).Sptr
> Errors
.Table
(E
).Sptr
then
314 Set_Next_Non_Deleted_Msg
(T
);
317 -- Output the error flags. The circuit here makes sure that the tab
318 -- characters in the original line are properly accounted for. The
319 -- eight blanks at the start are to match the line number.
321 if not Debug_Flag_2
then
323 P
:= Line_Start
(Errors
.Table
(E
).Sptr
);
326 -- Loop through error messages for this line to place flags
329 while T
/= No_Error_Msg
330 and then Errors
.Table
(T
).Line
= Errors
.Table
(E
).Line
331 and then Errors
.Table
(T
).Sfile
= Errors
.Table
(E
).Sfile
333 -- Loop to output blanks till current flag position
335 while P
< Errors
.Table
(T
).Sptr
loop
336 if Source_Text
(Errors
.Table
(T
).Sfile
) (P
) = ASCII
.HT
then
337 Write_Char
(ASCII
.HT
);
345 -- Output flag (unless already output, this happens if more
346 -- than one error message occurs at the same flag position).
348 if P
= Errors
.Table
(T
).Sptr
then
349 if (Flag_Num
= 1 and then not Mult_Flags
)
354 Write_Char
(Character'Val (Character'Pos ('0') + Flag_Num
));
360 Set_Next_Non_Deleted_Msg
(T
);
361 Flag_Num
:= Flag_Num
+ 1;
367 -- Now output the error messages
370 while T
/= No_Error_Msg
371 and then Errors
.Table
(T
).Line
= Errors
.Table
(E
).Line
372 and then Errors
.Table
(T
).Sfile
= Errors
.Table
(E
).Sfile
379 while Column
< 74 loop
387 Set_Next_Non_Deleted_Msg
(T
);
391 end Output_Error_Msgs
;
393 ------------------------
394 -- Output_Line_Number --
395 ------------------------
397 procedure Output_Line_Number
(L
: Logical_Line_Number
) is
398 D
: Int
; -- next digit
399 C
: Character; -- next character
400 Z
: Boolean; -- flag for zero suppress
401 N
, M
: Int
; -- temporaries
404 if L
= No_Line_Number
then
425 C
:= Character'Val (D
+ 48);
433 end Output_Line_Number
;
435 ---------------------
436 -- Output_Msg_Text --
437 ---------------------
439 procedure Output_Msg_Text
(E
: Error_Msg_Id
) is
441 if Errors
.Table
(E
).Warn
then
442 Write_Str
("warning: ");
444 elsif Errors
.Table
(E
).Style
then
447 elsif Opt
.Unique_Error_Tag
then
448 Write_Str
("error: ");
451 Write_Str
(Errors
.Table
(E
).Text
.all);
458 procedure Purge_Messages
(From
: Source_Ptr
; To
: Source_Ptr
) is
461 function To_Be_Purged
(E
: Error_Msg_Id
) return Boolean;
462 -- Returns True for a message that is to be purged. Also adjusts
463 -- error counts appropriately.
469 function To_Be_Purged
(E
: Error_Msg_Id
) return Boolean is
472 and then Errors
.Table
(E
).Sptr
> From
473 and then Errors
.Table
(E
).Sptr
< To
475 if Errors
.Table
(E
).Warn
or Errors
.Table
(E
).Style
then
476 Warnings_Detected
:= Warnings_Detected
- 1;
478 Total_Errors_Detected
:= Total_Errors_Detected
- 1;
480 if Errors
.Table
(E
).Serious
then
481 Serious_Errors_Detected
:= Serious_Errors_Detected
- 1;
492 -- Start of processing for Purge_Messages
495 while To_Be_Purged
(First_Error_Msg
) loop
496 First_Error_Msg
:= Errors
.Table
(First_Error_Msg
).Next
;
499 E
:= First_Error_Msg
;
500 while E
/= No_Error_Msg
loop
501 while To_Be_Purged
(Errors
.Table
(E
).Next
) loop
502 Errors
.Table
(E
).Next
:=
503 Errors
.Table
(Errors
.Table
(E
).Next
).Next
;
506 E
:= Errors
.Table
(E
).Next
;
514 function Same_Error
(M1
, M2
: Error_Msg_Id
) return Boolean is
515 Msg1
: constant String_Ptr
:= Errors
.Table
(M1
).Text
;
516 Msg2
: constant String_Ptr
:= Errors
.Table
(M2
).Text
;
518 Msg2_Len
: constant Integer := Msg2
'Length;
519 Msg1_Len
: constant Integer := Msg1
'Length;
525 (Msg1_Len
- 10 > Msg2_Len
527 Msg2
.all = Msg1
.all (1 .. Msg2_Len
)
529 Msg1
(Msg2_Len
+ 1 .. Msg2_Len
+ 10) = ", instance")
531 (Msg2_Len
- 10 > Msg1_Len
533 Msg1
.all = Msg2
.all (1 .. Msg1_Len
)
535 Msg2
(Msg1_Len
+ 1 .. Msg1_Len
+ 10) = ", instance");
542 procedure Set_Msg_Blank
is
545 and then Msg_Buffer
(Msglen
) /= ' '
546 and then Msg_Buffer
(Msglen
) /= '('
547 and then Msg_Buffer
(Msglen
) /= '-'
548 and then not Manual_Quote_Mode
554 -------------------------------
555 -- Set_Msg_Blank_Conditional --
556 -------------------------------
558 procedure Set_Msg_Blank_Conditional
is
561 and then Msg_Buffer
(Msglen
) /= ' '
562 and then Msg_Buffer
(Msglen
) /= '('
563 and then Msg_Buffer
(Msglen
) /= '"'
564 and then not Manual_Quote_Mode
568 end Set_Msg_Blank_Conditional
;
574 procedure Set_Msg_Char
(C
: Character) is
577 -- The check for message buffer overflow is needed to deal with cases
578 -- where insertions get too long (in particular a child unit name can
581 if Msglen
< Max_Msg_Length
then
582 Msglen
:= Msglen
+ 1;
583 Msg_Buffer
(Msglen
) := C
;
587 ---------------------------------
588 -- Set_Msg_Insertion_File_Name --
589 ---------------------------------
591 procedure Set_Msg_Insertion_File_Name
is
593 if Error_Msg_Name_1
= No_Name
then
596 elsif Error_Msg_Name_1
= Error_Name
then
598 Set_Msg_Str
("<error>");
602 Get_Name_String
(Error_Msg_Name_1
);
608 -- The following assignments ensure that the second and third percent
609 -- insertion characters will correspond to the Error_Msg_Name_2 and
610 -- Error_Msg_Name_3 as required. We suppress possible validity checks in
611 -- case operating in -gnatVa mode, and Error_Msg_Name_2/3 is not needed
612 -- and has not been set.
615 pragma Suppress
(Range_Check
);
617 Error_Msg_Name_1
:= Error_Msg_Name_2
;
618 Error_Msg_Name_2
:= Error_Msg_Name_3
;
620 end Set_Msg_Insertion_File_Name
;
622 -----------------------------------
623 -- Set_Msg_Insertion_Line_Number --
624 -----------------------------------
626 procedure Set_Msg_Insertion_Line_Number
(Loc
, Flag
: Source_Ptr
) is
627 Sindex_Loc
: Source_File_Index
;
628 Sindex_Flag
: Source_File_Index
;
633 if Loc
= No_Location
then
634 Set_Msg_Str
("at unknown location");
636 elsif Loc
= System_Location
then
637 Set_Msg_Str
("in package System");
638 Set_Msg_Insertion_Run_Time_Name
;
640 elsif Loc
= Standard_Location
then
641 Set_Msg_Str
("in package Standard");
643 elsif Loc
= Standard_ASCII_Location
then
644 Set_Msg_Str
("in package Standard.ASCII");
647 -- Add "at file-name:" if reference is to other than the source
648 -- file in which the error message is placed. Note that we check
649 -- full file names, rather than just the source indexes, to
650 -- deal with generic instantiations from the current file.
652 Sindex_Loc
:= Get_Source_File_Index
(Loc
);
653 Sindex_Flag
:= Get_Source_File_Index
(Flag
);
655 if Full_File_Name
(Sindex_Loc
) /= Full_File_Name
(Sindex_Flag
) then
658 (Reference_Name
(Get_Source_File_Index
(Loc
)));
662 -- If in current file, add text "at line "
665 Set_Msg_Str
("at line ");
668 -- Output line number for reference
670 Set_Msg_Int
(Int
(Get_Logical_Line_Number
(Loc
)));
672 -- Deal with the instantiation case. We may have a reference to,
673 -- e.g. a type, that is declared within a generic template, and
674 -- what we are really referring to is the occurrence in an instance.
675 -- In this case, the line number of the instantiation is also of
676 -- interest, and we add a notation:
680 -- where xxx is a line number output using this same routine (and
681 -- the recursion can go further if the instantiation is itself in
682 -- a generic template).
684 -- The flag location passed to us in this situation is indeed the
685 -- line number within the template, but as described in Sinput.L
686 -- (file sinput-l.ads, section "Handling Generic Instantiations")
687 -- we can retrieve the location of the instantiation itself from
688 -- this flag location value.
690 -- Note: this processing is suppressed if Suppress_Instance_Location
691 -- is set True. This is used to prevent redundant annotations of the
692 -- location of the instantiation in the case where we are placing
693 -- the messages on the instantiation in any case.
695 if Instantiation
(Sindex_Loc
) /= No_Location
696 and then not Suppress_Instance_Location
698 Set_Msg_Str
(", instance ");
699 Set_Msg_Insertion_Line_Number
(Instantiation
(Sindex_Loc
), Flag
);
702 end Set_Msg_Insertion_Line_Number
;
704 ----------------------------
705 -- Set_Msg_Insertion_Name --
706 ----------------------------
708 procedure Set_Msg_Insertion_Name
is
710 if Error_Msg_Name_1
= No_Name
then
713 elsif Error_Msg_Name_1
= Error_Name
then
715 Set_Msg_Str
("<error>");
718 Set_Msg_Blank_Conditional
;
719 Get_Unqualified_Decoded_Name_String
(Error_Msg_Name_1
);
721 -- Remove %s or %b at end. These come from unit names. If the
722 -- caller wanted the (unit) or (body), then they would have used
723 -- the $ insertion character. Certainly no error message should
724 -- ever have %b or %s explicitly occurring.
727 and then Name_Buffer
(Name_Len
- 1) = '%'
728 and then (Name_Buffer
(Name_Len
) = 'b'
730 Name_Buffer
(Name_Len
) = 's')
732 Name_Len
:= Name_Len
- 2;
735 -- Remove upper case letter at end, again, we should not be getting
736 -- such names, and what we hope is that the remainder makes sense.
739 and then Name_Buffer
(Name_Len
) in 'A' .. 'Z'
741 Name_Len
:= Name_Len
- 1;
744 -- If operator name or character literal name, just print it as is
745 -- Also print as is if it ends in a right paren (case of x'val(nnn))
747 if Name_Buffer
(1) = '"'
748 or else Name_Buffer
(1) = '''
749 or else Name_Buffer
(Name_Len
) = ')'
753 -- Else output with surrounding quotes in proper casing mode
756 Set_Casing
(Identifier_Casing
(Flag_Source
), Mixed_Case
);
763 -- The following assignments ensure that the second and third percent
764 -- insertion characters will correspond to the Error_Msg_Name_2 and
765 -- Error_Msg_Name_3 as required. We suppress possible validity checks in
766 -- case operating in -gnatVa mode, and Error_Msg_Name_1/2 is not needed
767 -- and has not been set.
770 pragma Suppress
(Range_Check
);
772 Error_Msg_Name_1
:= Error_Msg_Name_2
;
773 Error_Msg_Name_2
:= Error_Msg_Name_3
;
775 end Set_Msg_Insertion_Name
;
777 -------------------------------------
778 -- Set_Msg_Insertion_Reserved_Name --
779 -------------------------------------
781 procedure Set_Msg_Insertion_Reserved_Name
is
783 Set_Msg_Blank_Conditional
;
784 Get_Name_String
(Error_Msg_Name_1
);
786 Set_Casing
(Keyword_Casing
(Flag_Source
), All_Lower_Case
);
789 end Set_Msg_Insertion_Reserved_Name
;
791 -------------------------------------
792 -- Set_Msg_Insertion_Reserved_Word --
793 -------------------------------------
795 procedure Set_Msg_Insertion_Reserved_Word
800 Set_Msg_Blank_Conditional
;
803 while J
<= Text
'Last and then Text
(J
) in 'A' .. 'Z' loop
804 Name_Len
:= Name_Len
+ 1;
805 Name_Buffer
(Name_Len
) := Text
(J
);
809 Set_Casing
(Keyword_Casing
(Flag_Source
), All_Lower_Case
);
813 end Set_Msg_Insertion_Reserved_Word
;
815 -------------------------------------
816 -- Set_Msg_Insertion_Run_Time_Name --
817 -------------------------------------
819 procedure Set_Msg_Insertion_Run_Time_Name
is
821 if Targparm
.Run_Time_Name_On_Target
/= No_Name
then
822 Set_Msg_Blank_Conditional
;
824 Get_Name_String
(Targparm
.Run_Time_Name_On_Target
);
825 Set_Casing
(Mixed_Case
);
826 Set_Msg_Str
(Name_Buffer
(1 .. Name_Len
));
829 end Set_Msg_Insertion_Run_Time_Name
;
831 ----------------------------
832 -- Set_Msg_Insertion_Uint --
833 ----------------------------
835 procedure Set_Msg_Insertion_Uint
is
838 UI_Image
(Error_Msg_Uint_1
);
840 for J
in 1 .. UI_Image_Length
loop
841 Set_Msg_Char
(UI_Image_Buffer
(J
));
844 -- The following assignment ensures that a second carret insertion
845 -- character will correspond to the Error_Msg_Uint_2 parameter. We
846 -- suppress possible validity checks in case operating in -gnatVa mode,
847 -- and Error_Msg_Uint_2 is not needed and has not been set.
850 pragma Suppress
(Range_Check
);
852 Error_Msg_Uint_1
:= Error_Msg_Uint_2
;
854 end Set_Msg_Insertion_Uint
;
860 procedure Set_Msg_Int
(Line
: Int
) is
863 Set_Msg_Int
(Line
/ 10);
866 Set_Msg_Char
(Character'Val (Character'Pos ('0') + (Line
rem 10)));
869 -------------------------
870 -- Set_Msg_Name_Buffer --
871 -------------------------
873 procedure Set_Msg_Name_Buffer
is
875 for J
in 1 .. Name_Len
loop
876 Set_Msg_Char
(Name_Buffer
(J
));
878 end Set_Msg_Name_Buffer
;
884 procedure Set_Msg_Quote
is
886 if not Manual_Quote_Mode
then
895 procedure Set_Msg_Str
(Text
: String) is
897 for J
in Text
'Range loop
898 Set_Msg_Char
(Text
(J
));
902 ------------------------------
903 -- Set_Next_Non_Deleted_Msg --
904 ------------------------------
906 procedure Set_Next_Non_Deleted_Msg
(E
: in out Error_Msg_Id
) is
908 if E
= No_Error_Msg
then
913 E
:= Errors
.Table
(E
).Next
;
914 exit when E
= No_Error_Msg
or else not Errors
.Table
(E
).Deleted
;
917 end Set_Next_Non_Deleted_Msg
;
919 ---------------------------
920 -- Set_Warnings_Mode_Off --
921 ---------------------------
923 procedure Set_Warnings_Mode_Off
(Loc
: Source_Ptr
) is
925 -- Don't bother with entries from instantiation copies, since we
926 -- will already have a copy in the template, which is what matters
928 if Instantiation
(Get_Source_File_Index
(Loc
)) /= No_Location
then
932 -- If last entry in table already covers us, this is a redundant
933 -- pragma Warnings (Off) and can be ignored. This also handles the
934 -- case where all warnings are suppressed by command line switch.
936 if Warnings
.Last
>= Warnings
.First
937 and then Warnings
.Table
(Warnings
.Last
).Start
<= Loc
938 and then Loc
<= Warnings
.Table
(Warnings
.Last
).Stop
942 -- Otherwise establish a new entry, extending from the location of
943 -- the pragma to the end of the current source file. This ending
944 -- point will be adjusted by a subsequent pragma Warnings (On).
947 Warnings
.Increment_Last
;
948 Warnings
.Table
(Warnings
.Last
).Start
:= Loc
;
949 Warnings
.Table
(Warnings
.Last
).Stop
:=
950 Source_Last
(Current_Source_File
);
952 end Set_Warnings_Mode_Off
;
954 --------------------------
955 -- Set_Warnings_Mode_On --
956 --------------------------
958 procedure Set_Warnings_Mode_On
(Loc
: Source_Ptr
) is
960 -- Don't bother with entries from instantiation copies, since we
961 -- will already have a copy in the template, which is what matters
963 if Instantiation
(Get_Source_File_Index
(Loc
)) /= No_Location
then
967 -- Nothing to do unless command line switch to suppress all warnings
968 -- is off, and the last entry in the warnings table covers this
969 -- pragma Warnings (On), in which case adjust the end point.
971 if (Warnings
.Last
>= Warnings
.First
972 and then Warnings
.Table
(Warnings
.Last
).Start
<= Loc
973 and then Loc
<= Warnings
.Table
(Warnings
.Last
).Stop
)
974 and then Warning_Mode
/= Suppress
976 Warnings
.Table
(Warnings
.Last
).Stop
:= Loc
;
978 end Set_Warnings_Mode_On
;
980 ------------------------------------
981 -- Test_Style_Warning_Serious_Msg --
982 ------------------------------------
984 procedure Test_Style_Warning_Serious_Msg
(Msg
: String) is
986 if Msg
(Msg
'First) = '\' then
990 Is_Serious_Error
:= True;
991 Is_Warning_Msg
:= False;
995 and then Msg
(Msg
'First .. Msg
'First + 6) = "(style)");
997 for J
in Msg
'Range loop
999 and then (J
= Msg
'First or else Msg
(J
- 1) /= ''')
1001 Is_Warning_Msg
:= True;
1004 and then (J
= Msg
'First or else Msg
(J
- 1) /= ''')
1006 Is_Warning_Msg
:= Error_Msg_Warn
;
1009 and then (J
= Msg
'First or else Msg
(J
- 1) /= ''')
1011 Is_Serious_Error
:= False;
1015 if Is_Warning_Msg
or else Is_Style_Msg
then
1016 Is_Serious_Error
:= False;
1018 end Test_Style_Warning_Serious_Msg
;
1020 -------------------------
1021 -- Warnings_Suppressed --
1022 -------------------------
1024 function Warnings_Suppressed
(Loc
: Source_Ptr
) return Boolean is
1026 for J
in Warnings
.First
.. Warnings
.Last
loop
1027 if Warnings
.Table
(J
).Start
<= Loc
1028 and then Loc
<= Warnings
.Table
(J
).Stop
1035 end Warnings_Suppressed
;