mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 15:31:11 +08:00
binderr.adb, [...]: New circuitry for handling Maximum_Messages.
2009-04-09 Robert Dewar <dewar@adacore.com> * binderr.adb, errout.adb, errutil.adb: New circuitry for handling Maximum_Messages. * erroutc.adb, erroutc.ads (Warnings_Suppressed): Now tests global warning status as well. * opt.ads (Maximum_Messages): New name for Maximum_Errors. * switch-b.adb, switch-c.adb: Change name Maximum_Errors to Maximum_Messages. * bindusg.adb, usage.adb: Update line for -gnatm switch * gnat_ugn.texi: Update documentation for -gnatmnn compiler switch and -mnn binder switch. * sem_ch10.adb: Minor reformatting. From-SVN: r145822
This commit is contained in:
parent
beb50807ad
commit
923e6ff331
@ -1,3 +1,25 @@
|
||||
2009-04-09 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* binderr.adb, errout.adb, errutil.adb: New circuitry for handling
|
||||
Maximum_Messages.
|
||||
|
||||
* erroutc.adb, erroutc.ads (Warnings_Suppressed): Now tests global
|
||||
warning status as well.
|
||||
|
||||
* opt.ads (Maximum_Messages): New name for Maximum_Errors.
|
||||
|
||||
* switch-b.adb, switch-c.adb: Change name Maximum_Errors to
|
||||
Maximum_Messages.
|
||||
|
||||
* bindusg.adb, usage.adb: Update line for -gnatm switch
|
||||
|
||||
* gnat_ugn.texi: Update documentation for -gnatmnn compiler switch and
|
||||
-mnn binder switch.
|
||||
|
||||
2009-04-09 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* sem_ch10.adb: Minor reformatting.
|
||||
|
||||
2009-04-09 Bob Duff <duff@adacore.com>
|
||||
|
||||
* exp_ch11.adb (Expand_Exception_Handlers, Prepend_Call_To_Handler):
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- GNAT is free software; you can redistribute it and/or modify it under --
|
||||
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||
@ -64,10 +64,24 @@ package body Binderr is
|
||||
Error_Msg_Output (Msg, Info => False);
|
||||
end if;
|
||||
|
||||
if Warnings_Detected + Errors_Detected > Maximum_Errors then
|
||||
raise Unrecoverable_Error;
|
||||
-- If too many warnings print message and then turn off warnings
|
||||
|
||||
if Warnings_Detected = Maximum_Messages then
|
||||
Set_Standard_Error;
|
||||
Write_Line ("maximum number of warnings reached");
|
||||
Write_Line ("further warnings will be suppressed");
|
||||
Set_Standard_Output;
|
||||
Warning_Mode := Suppress;
|
||||
end if;
|
||||
|
||||
-- If too many errors print message and give fatal error
|
||||
|
||||
if Errors_Detected = Maximum_Messages then
|
||||
Set_Standard_Error;
|
||||
Write_Line ("fatal error: maximum number of errors exceeded");
|
||||
Set_Standard_Output;
|
||||
raise Unrecoverable_Error;
|
||||
end if;
|
||||
end Error_Msg;
|
||||
|
||||
--------------------
|
||||
@ -99,7 +113,7 @@ package body Binderr is
|
||||
Warning : Boolean := False;
|
||||
|
||||
begin
|
||||
if Warnings_Detected + Errors_Detected > Maximum_Errors then
|
||||
if Warnings_Detected + Errors_Detected > Maximum_Messages then
|
||||
Write_Str ("error: maximum errors exceeded");
|
||||
Write_Eol;
|
||||
return;
|
||||
|
@ -142,7 +142,7 @@ package body Bindusg is
|
||||
|
||||
-- Line for -m switch
|
||||
|
||||
Write_Line (" -mnnn Limit number of detected errors " &
|
||||
Write_Line (" -mnnn Limit number of detected errors/warnings " &
|
||||
"to nnn (1-999999)");
|
||||
|
||||
-- Line for -M switch
|
||||
|
@ -328,11 +328,20 @@ package body Errout is
|
||||
Warn_On_Instance := Is_Warning_Msg;
|
||||
end if;
|
||||
|
||||
-- Ignore warning message that is suppressed. Note that style
|
||||
-- checks are not considered warning messages for this purpose
|
||||
-- Ignore warning message that is suppressed for this location. Note
|
||||
-- that style checks are not considered warning messages for this
|
||||
-- purpose.
|
||||
|
||||
if Is_Warning_Msg and then Warnings_Suppressed (Orig_Loc) then
|
||||
return;
|
||||
|
||||
-- For style messages, check too many messages so far
|
||||
|
||||
elsif Is_Style_Msg
|
||||
and then Maximum_Messages /= 0
|
||||
and then Warnings_Detected >= Maximum_Messages
|
||||
then
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- The idea at this stage is that we have two kinds of messages
|
||||
@ -1034,10 +1043,18 @@ package body Errout is
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- Terminate if max errors reached
|
||||
-- If too many warnings turn off warnings
|
||||
|
||||
if Total_Errors_Detected + Warnings_Detected = Maximum_Errors then
|
||||
raise Unrecoverable_Error;
|
||||
if Maximum_Messages /= 0 then
|
||||
if Warnings_Detected = Maximum_Messages then
|
||||
Warning_Mode := Suppress;
|
||||
end if;
|
||||
|
||||
-- If too many errors abandon compilation
|
||||
|
||||
if Total_Errors_Detected = Maximum_Messages then
|
||||
raise Unrecoverable_Error;
|
||||
end if;
|
||||
end if;
|
||||
end Error_Msg_Internal;
|
||||
|
||||
@ -1556,13 +1573,21 @@ package body Errout is
|
||||
|
||||
procedure Write_Max_Errors is
|
||||
begin
|
||||
if Maximum_Errors /= 0
|
||||
and then Total_Errors_Detected + Warnings_Detected = Maximum_Errors
|
||||
then
|
||||
Set_Standard_Error;
|
||||
Write_Str ("fatal error: maximum errors reached");
|
||||
Write_Eol;
|
||||
Set_Standard_Output;
|
||||
if Maximum_Messages /= 0 then
|
||||
if Warnings_Detected >= Maximum_Messages then
|
||||
Set_Standard_Error;
|
||||
Write_Line ("maximum number of warnings output");
|
||||
Write_Line ("any further warnings suppressed");
|
||||
Set_Standard_Output;
|
||||
end if;
|
||||
|
||||
-- If too many errors print message
|
||||
|
||||
if Total_Errors_Detected >= Maximum_Messages then
|
||||
Set_Standard_Error;
|
||||
Write_Line ("fatal error: maximum number of errors detected");
|
||||
Set_Standard_Output;
|
||||
end if;
|
||||
end if;
|
||||
end Write_Max_Errors;
|
||||
|
||||
|
@ -1340,6 +1340,10 @@ package body Erroutc is
|
||||
|
||||
function Warnings_Suppressed (Loc : Source_Ptr) return Boolean is
|
||||
begin
|
||||
if Warning_Mode = Suppress then
|
||||
return True;
|
||||
end if;
|
||||
|
||||
-- Loop through table of ON/OFF warnings
|
||||
|
||||
for J in Warnings.First .. Warnings.Last loop
|
||||
|
@ -481,7 +481,8 @@ package Erroutc is
|
||||
-- Determines if given location is covered by a warnings off suppression
|
||||
-- range in the warnings table (or is suppressed by compilation option,
|
||||
-- which generates a warning range for the whole source file). This routine
|
||||
-- only deals with the general ON/OFF case, not specific warnings
|
||||
-- only deals with the general ON/OFF case, not specific warnings. True
|
||||
-- is also returned if warnings are globally suppressed.
|
||||
|
||||
function Warning_Specifically_Suppressed
|
||||
(Loc : Source_Ptr;
|
||||
|
@ -548,13 +548,18 @@ package body Errutil is
|
||||
Set_Standard_Output;
|
||||
end if;
|
||||
|
||||
if Maximum_Errors /= 0
|
||||
and then Total_Errors_Detected + Warnings_Detected = Maximum_Errors
|
||||
then
|
||||
Set_Standard_Error;
|
||||
Write_Str ("fatal error: maximum errors reached");
|
||||
Write_Eol;
|
||||
Set_Standard_Output;
|
||||
if Maximum_Messages /= 0 then
|
||||
if Warnings_Detected >= Maximum_Messages then
|
||||
Set_Standard_Error;
|
||||
Write_Line ("maximum number of warnings detected");
|
||||
Warning_Mode := Suppress;
|
||||
end if;
|
||||
|
||||
if Total_Errors_Detected >= Maximum_Messages then
|
||||
Set_Standard_Error;
|
||||
Write_Line ("fatal error: maximum errors reached");
|
||||
Set_Standard_Output;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
if Warning_Mode = Treat_As_Error then
|
||||
|
@ -3995,9 +3995,13 @@ source output.
|
||||
@item -gnatm=@var{n}
|
||||
@cindex @option{-gnatm} (@command{gcc})
|
||||
Limit number of detected error or warning messages to @var{n}
|
||||
where @var{n} is in the range 1..999_999. The default setting if
|
||||
no switch is given is 9999. Compilation is terminated if this
|
||||
limit is exceeded. The equal sign here is optional.
|
||||
where @var{n} is in the range 1..999999. The default setting if
|
||||
no switch is given is 9999. If the number of warnings reaches this
|
||||
limit, then a message is output and further warnings are suppressed,
|
||||
but the compilation is continued. If the number of error messages
|
||||
reaches this limit, then a message is output and the compilation
|
||||
is abandoned. The equal sign here is optional. A value of zero
|
||||
means that no limit applies.
|
||||
|
||||
@item -gnatn
|
||||
@cindex @option{-gnatn} (@command{gcc})
|
||||
@ -4488,16 +4492,25 @@ format message or full listing (which as usual is written to
|
||||
The @code{m} stands for maximum.
|
||||
@end ifclear
|
||||
@var{n} is a decimal integer in the
|
||||
range of 1 to 999 and limits the number of error messages to be
|
||||
generated. For example, using @option{-gnatm2} might yield
|
||||
range of 1 to 999999 and limits the number of error or warning
|
||||
messages to be generated. For example, using
|
||||
@option{-gnatm2} might yield
|
||||
|
||||
@smallexample
|
||||
e.adb:3:04: Incorrect spelling of keyword "function"
|
||||
e.adb:5:35: missing ".."
|
||||
fatal error: maximum errors reached
|
||||
fatal error: maximum number of errors detected
|
||||
compilation abandoned
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
The default setting if
|
||||
no switch is given is 9999. If the number of warnings reaches this
|
||||
limit, then a message is output and further warnings are suppressed,
|
||||
but the compilation is continued. If the number of error messages
|
||||
reaches this limit, then a message is output and the compilation
|
||||
is abandoned. A value of zero means that no limit applies.
|
||||
|
||||
@noindent
|
||||
Note that the equal sign is optional, so the switches
|
||||
@option{-gnatm2} and @option{-gnatm=2} are equivalent.
|
||||
@ -7799,9 +7812,15 @@ supported on cross environments only.
|
||||
|
||||
@item ^-m^/ERROR_LIMIT=^@var{n}
|
||||
@cindex @option{^-m^/ERROR_LIMIT^} (@command{gnatbind})
|
||||
Limit number of detected errors to @var{n}, where @var{n} is
|
||||
in the range 1..999_999. The default value if no switch is
|
||||
given is 9999. Binding is terminated if the limit is exceeded.
|
||||
Limit number of detected errors or warnings to @var{n}, where @var{n} is
|
||||
in the range 1..999999. The default value if no switch is
|
||||
given is 9999. If the number of warnings reaches this limit, then a
|
||||
message is output and further warnings are suppressed, the bind
|
||||
continues in this case. If the number of errors reaches this
|
||||
limit, then a message is output and the bind is abandoned.
|
||||
A value of zero means that no limit is enforced. The equal
|
||||
sign is optional.
|
||||
|
||||
@ifset unw
|
||||
Furthermore, under Windows, the sources pointed to by the libraries path
|
||||
set in the registry are not searched for.
|
||||
|
@ -806,10 +806,11 @@ package Opt is
|
||||
-- File name of mapping between unit names, file names and path names.
|
||||
-- (given by switch -gnatem)
|
||||
|
||||
Maximum_Errors : Int := 9999;
|
||||
Maximum_Messages : Int := 9999;
|
||||
-- GNAT, GNATBIND
|
||||
-- Maximum default number of errors before compilation is terminated.
|
||||
-- Can be overridden using -gnatm (GNAT) or -m (GNATBIND) switch.
|
||||
-- Maximum default number of errors before compilation is terminated, or in
|
||||
-- the case of GNAT, maximum number of warnings before further warnings are
|
||||
-- suppressed. Can be overridden by -gnatm (GNAT) or -m (GNATBIND) switch.
|
||||
|
||||
Maximum_File_Name_Length : Int;
|
||||
-- GNAT, GNATBIND
|
||||
|
@ -3369,7 +3369,7 @@ package body Sem_Ch10 is
|
||||
N_Subprogram_Body,
|
||||
N_Subunit)
|
||||
then
|
||||
-- Current unit is private, of descendant of a private unit.
|
||||
-- Current unit is private, of descendant of a private unit
|
||||
|
||||
null;
|
||||
|
||||
|
@ -286,7 +286,7 @@ package body Switch.B is
|
||||
end if;
|
||||
|
||||
Ptr := Ptr + 1;
|
||||
Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Errors, C);
|
||||
Scan_Pos (Switch_Chars, Max, Ptr, Maximum_Messages, C);
|
||||
|
||||
-- Processing for n switch
|
||||
|
||||
|
@ -633,7 +633,7 @@ package body Switch.C is
|
||||
Ptr := Ptr + 1;
|
||||
end if;
|
||||
|
||||
Scan_Nat (Switch_Chars, Max, Ptr, Maximum_Errors, C);
|
||||
Scan_Nat (Switch_Chars, Max, Ptr, Maximum_Messages, C);
|
||||
|
||||
-- Processing for n switch
|
||||
|
||||
|
@ -261,7 +261,7 @@ begin
|
||||
-- Line for -gnatm switch
|
||||
|
||||
Write_Switch_Char ("mnn");
|
||||
Write_Line ("Limit number of detected errors to nn (1-999999)");
|
||||
Write_Line ("Limit number of detected errors/warnings to nn (1-999999)");
|
||||
|
||||
-- Line for -gnatn switch
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user