From: Piotr Trojanek <troja...@adacore.com>

Code cleanup suggested by GNATcheck rule Constant_Overlays.

gcc/ada/ChangeLog:

        * repinfo-input.adb (Decode_Name, Read_Name_With_Prefix): Use constant
        overlay with pragma Import.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/repinfo-input.adb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/repinfo-input.adb b/gcc/ada/repinfo-input.adb
index 78de4412228..c5cc34a6350 100644
--- a/gcc/ada/repinfo-input.adb
+++ b/gcc/ada/repinfo-input.adb
@@ -341,7 +341,8 @@ package body Repinfo.Input is
 
          else
             declare
-               S : String (Integer (Lo) .. Integer (Hi));
+               S : constant String (Integer (Lo) .. Integer (Hi));
+               pragma Import (Ada, S);
                for S'Address use Text (Lo)'Address;
 
             begin
@@ -627,7 +628,8 @@ package body Repinfo.Input is
 
          else
             declare
-               S : String (Integer (Lo) .. Integer (Hi));
+               S : constant String (Integer (Lo) .. Integer (Hi));
+               pragma Import (Ada, S);
                for S'Address use Text (Lo)'Address;
 
             begin
-- 
2.43.0

Reply via email to