diff mbox series

[Ada] Justify false positive message from CodePeer analysis of GNAT

Message ID 20220106171253.GA2921446@adacore.com
State New
Headers show
Series [Ada] Justify false positive message from CodePeer analysis of GNAT | expand

Commit Message

Pierre-Marie de Rodat Jan. 6, 2022, 5:12 p.m. UTC
Analysis of loop variant is known to lead to false alarms with CodePeer.
Add pragma Annotate in such a case which can be justified.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* libgnat/s-exponu.adb (Exponu): Add annotation.
diff mbox series

Patch

diff --git a/gcc/ada/libgnat/s-exponu.adb b/gcc/ada/libgnat/s-exponu.adb
--- a/gcc/ada/libgnat/s-exponu.adb
+++ b/gcc/ada/libgnat/s-exponu.adb
@@ -64,6 +64,9 @@  begin
          pragma Loop_Invariant (Exp > 0);
          pragma Loop_Invariant (Result * Factor ** Exp = Left ** Right);
          pragma Loop_Variant (Decreases => Exp);
+         pragma Annotate
+           (CodePeer, False_Positive,
+            "validity check", "confusion on generated code");
 
          if Exp rem 2 /= 0 then
             pragma Assert