[gcc r12-6247] [Ada] Simplify calls to Name_Find with known string parameter

Pierre-Marie de Rodat pmderodat@gcc.gnu.org
Wed Jan 5 11:35:19 GMT 2022


https://gcc.gnu.org/g:ad2fd234e7087b2a7bb7e3554736663d3ea5d6be

commit r12-6247-gad2fd234e7087b2a7bb7e3554736663d3ea5d6be
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Dec 1 16:54:43 2021 +0100

    [Ada] Simplify calls to Name_Find with known string parameter
    
    gcc/ada/
    
            * gnatls.adb (Gnatls): Use Name_Find function.
            * targparm.adb (Get_Target_Parameters): Likewise.

Diff:
---
 gcc/ada/gnatls.adb   | 5 +----
 gcc/ada/targparm.adb | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/gcc/ada/gnatls.adb b/gcc/ada/gnatls.adb
index b20cda4fdd6..4c69b727aaf 100644
--- a/gcc/ada/gnatls.adb
+++ b/gcc/ada/gnatls.adb
@@ -2092,10 +2092,7 @@ begin
          Hi   : Source_Ptr;
 
       begin
-         Name_Buffer (1 .. 10) := "system.ads";
-         Name_Len := 10;
-
-         Read_Source_File (Name_Find, 0, Hi, Text, FD);
+         Read_Source_File (Name_Find ("system.ads"), 0, Hi, Text, FD);
 
          if Null_Source_Buffer_Ptr (Text) then
             No_Runtime := True;
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index ade05c25795..d5755e1ee08 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -157,10 +157,7 @@ package body Targparm is
          return;
       end if;
 
-      Name_Buffer (1 .. 10) := "system.ads";
-      Name_Len := 10;
-
-      Read_Source_File (Name_Find, 0, Hi, Text, FD);
+      Read_Source_File (Name_Find ("system.ads"), 0, Hi, Text, FD);
 
       if Null_Source_Buffer_Ptr (Text) then
          Write_Line ("fatal error, run-time library not installed correctly");


More information about the Gcc-cvs mailing list