[Ada] Fix CodePeer warnings
authorGhjuvan Lacambre <lacambre@adacore.com>
Thu, 12 Aug 2021 13:05:23 +0000 (15:05 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 1 Oct 2021 06:13:38 +0000 (06:13 +0000)
gcc/ada/

* atree.adb (Print_Statistics): Help CodePeer see Total as
greater than zero.
* gen_il-gen.adb (One_Comp): Annotate Field_Table as Modified.

gcc/ada/atree.adb
gcc/ada/gen_il-gen.adb

index 5af4b13..ce92548 100644 (file)
@@ -2503,6 +2503,10 @@ package body Atree is
          Total := G_Total + S_Total;
       end loop;
 
+      --  This assertion helps CodePeer understand that Total cannot be 0 (this
+      --  is true because GNAT does not attempt to compile empty files).
+      pragma Assert (Total > 0);
+
       Write_Int_64 (Total);
       Write_Str (" (100%) = ");
       Write_Int_64 (G_Total);
index e3b034a..dd8487d 100644 (file)
@@ -2347,6 +2347,7 @@ package body Gen_IL.Gen is
                procedure One_Comp (F : Field_Enum);
 
                procedure One_Comp (F : Field_Enum) is
+                  pragma Annotate (Codepeer, Modified, Field_Table);
                   Offset : constant Field_Offset :=  Field_Table (F).Offset;
                begin
                   if First_Time then