From patchwork Wed Jun 23 05:41:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Ada] Fix warning count when deleting continuations Date: Tue, 22 Jun 2010 19:41:09 -0000 From: Arnaud Charlet X-Patchwork-Id: 56584 Message-Id: <20100623054109.GA9066@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Robert Dewar The previous patch to delete continuations left the warning count wrong. This patch corrects that. The following test compiled with -gnatld7 generates: Compiling: warncount.ads 1. pragma Warnings (Off, "*foreign convention*"); 2. pragma Warnings (Off, "*add Convention pragma*"); 3. package Warncount is 4. type r is access procedure; 5. procedure C (arg : r); 6. pragma Import (C, C); 7. end; 7 lines: No errors Prior to this patch, the summary line would include 1 warning Tested on x86_64-pc-linux-gnu, committed on trunk 2010-06-23 Robert Dewar * errout.adb (Finalize): Properly adjust warning count when deleting continuations. Index: errout.adb =================================================================== --- errout.adb (revision 161215) +++ errout.adb (working copy) @@ -1215,6 +1215,23 @@ package body Errout is Nxt : Error_Msg_Id; F : Error_Msg_Id; + procedure Delete_Warning (E : Error_Msg_Id); + -- Delete a message if not already deleted and adjust warning count + + -------------------- + -- Delete_Warning -- + -------------------- + + procedure Delete_Warning (E : Error_Msg_Id) is + begin + if not Errors.Table (E).Deleted then + Errors.Table (E).Deleted := True; + Warnings_Detected := Warnings_Detected - 1; + end if; + end Delete_Warning; + + -- Start of message for Finalize + begin -- Set Prev pointers @@ -1252,15 +1269,14 @@ package body Errout is and then Warning_Specifically_Suppressed (Errors.Table (Cur).Sptr, Errors.Table (Cur).Text) then - Errors.Table (Cur).Deleted := True; - Warnings_Detected := Warnings_Detected - 1; + Delete_Warning (Cur); -- If this is a continuation, delete previous messages F := Cur; while Errors.Table (F).Msg_Cont loop F := Errors.Table (F).Prev; - Errors.Table (F).Deleted := True; + Delete_Warning (F); end loop; -- Delete any following continuations @@ -1270,7 +1286,7 @@ package body Errout is F := Errors.Table (F).Next; exit when F = No_Error_Msg; exit when not Errors.Table (F).Msg_Cont; - Errors.Table (F).Deleted := True; + Delete_Warning (F); end loop; end if;