[Ada] Justify false alarm from CodePeer analysis of GNAT

Message ID 20220912081937.GA1513056@poulhies-Precision-5550
State New, archived
Headers
Series [Ada] Justify false alarm from CodePeer analysis of GNAT |

Commit Message

Marc Poulhiès Sept. 12, 2022, 8:19 a.m. UTC
  Branch is determined as dead following a test always False by
CodePeer analysis, which is incorrect. Justify this false alarm
with an appropriate pragma Annotate.

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

gcc/ada/

	* libgnat/s-imagei.adb (Image_Integer): Add justification.
  

Patch

diff --git a/gcc/ada/libgnat/s-imagei.adb b/gcc/ada/libgnat/s-imagei.adb
--- a/gcc/ada/libgnat/s-imagei.adb
+++ b/gcc/ada/libgnat/s-imagei.adb
@@ -177,6 +177,8 @@  package body System.Image_I is
 
    begin
       if V >= 0 then
+         pragma Annotate (CodePeer, False_Positive, "test always false",
+                          "V can be positive");
          S (1) := ' ';
          P := 1;
          pragma Assert (P < S'Last);