diff options
author | Robert Dewar <dewar@adacore.com> | 2009-04-09 10:38:54 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-09 12:38:54 +0200 |
commit | 923e6ff331d3e4c0109529937c5ee589dfbe93b8 (patch) | |
tree | 31ba08971e0c8db8e92b164c64a7ddadbd742ba1 | |
parent | beb50807addf7817dafe8c229f9e9d9a09f5b828 (diff) | |
download | gcc-923e6ff331d3e4c0109529937c5ee589dfbe93b8.zip gcc-923e6ff331d3e4c0109529937c5ee589dfbe93b8.tar.gz gcc-923e6ff331d3e4c0109529937c5ee589dfbe93b8.tar.bz2 |
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
-rw-r--r-- | gcc/ada/ChangeLog | 22 | ||||
-rw-r--r-- | gcc/ada/binderr.adb | 22 | ||||
-rw-r--r-- | gcc/ada/bindusg.adb | 2 | ||||
-rw-r--r-- | gcc/ada/errout.adb | 49 | ||||
-rw-r--r-- | gcc/ada/erroutc.adb | 4 | ||||
-rw-r--r-- | gcc/ada/erroutc.ads | 3 | ||||
-rw-r--r-- | gcc/ada/errutil.adb | 19 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 37 | ||||
-rw-r--r-- | gcc/ada/opt.ads | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch10.adb | 2 | ||||
-rw-r--r-- | gcc/ada/switch-b.adb | 2 | ||||
-rw-r--r-- | gcc/ada/switch-c.adb | 2 | ||||
-rw-r--r-- | gcc/ada/usage.adb | 2 |
13 files changed, 132 insertions, 41 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index cc7bcf9..fe58ae8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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): diff --git a/gcc/ada/binderr.adb b/gcc/ada/binderr.adb index 4f90ee68..830a2f1 100644 --- a/gcc/ada/binderr.adb +++ b/gcc/ada/binderr.adb @@ -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; diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb index a70aaa9..19d0c14 100644 --- a/gcc/ada/bindusg.adb +++ b/gcc/ada/bindusg.adb @@ -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 diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 6f122f6..0424880 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -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; diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index f255ac0..a5d963f 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -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 diff --git a/gcc/ada/erroutc.ads b/gcc/ada/erroutc.ads index ba212ee..f2127de 100644 --- a/gcc/ada/erroutc.ads +++ b/gcc/ada/erroutc.ads @@ -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; diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb index 222f73b..480a355 100644 --- a/gcc/ada/errutil.adb +++ b/gcc/ada/errutil.adb @@ -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 diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 9b17e2c..7907023 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -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,17 +4492,26 @@ 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. diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 1aba6eb..3093d37 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -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 diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 9e20de1..a4a9254 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -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; diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb index 0d673b7..e3e597b 100644 --- a/gcc/ada/switch-b.adb +++ b/gcc/ada/switch-b.adb @@ -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 diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index ddd4859..23b9551 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -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 diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index e69695b..55a3f49 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -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 |