summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2007-04-06 11:23:52 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-04-06 11:23:52 +0200
commitff5066d40b3d80ecc7ab688b3936d09019c42e02 (patch)
tree4c921244cce9321f7d6378b3cb0d49cdcadc99e8 /gcc
parent2491bb7d8eff1dbc3d0639a05b8583c7e9e28d55 (diff)
downloadgcc-ff5066d40b3d80ecc7ab688b3936d09019c42e02.tar.gz
lib-writ.adb (Write_With_Lines): Factor duplicated code between the cases where a given dependency has a body or not.
2007-04-06 Thomas Quinot <quinot@adacore.com> * lib-writ.adb (Write_With_Lines): Factor duplicated code between the cases where a given dependency has a body or not. (Write_With_File_Names): New subprogram, common code for the two cases above. From-SVN: r123582
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/lib-writ.adb56
1 files changed, 30 insertions, 26 deletions
diff --git a/gcc/ada/lib-writ.adb b/gcc/ada/lib-writ.adb
index 521e0625734..14c62f0f49f 100644
--- a/gcc/ada/lib-writ.adb
+++ b/gcc/ada/lib-writ.adb
@@ -629,6 +629,34 @@ package body Lib.Writ is
Body_Fname : File_Name_Type;
Body_Index : Nat;
+ procedure Write_With_File_Names
+ (Nam : in out File_Name_Type;
+ Idx : Nat);
+ -- Write source file name Nam and ALI file name for unit index Idx.
+ -- Possibly change Nam to lowercase (generating a new file name).
+
+ --------------------------
+ -- Write_With_File_Name --
+ --------------------------
+
+ procedure Write_With_File_Names
+ (Nam : in out File_Name_Type;
+ Idx : Nat)
+ is
+ begin
+ if not File_Names_Case_Sensitive then
+ Get_Name_String (Nam);
+ To_Lower (Name_Buffer (1 .. Name_Len));
+ Nam := Name_Find;
+ end if;
+
+ Write_Info_Name (Nam);
+ Write_Info_Tab (49);
+ Write_Info_Name (Lib_File_Name (Nam, Idx));
+ end Write_With_File_Names;
+
+ -- Start of processing for Write_With_Lines
+
begin
-- Loop to build the with table. A with on the main unit itself
-- is ignored (AARM 10.2(14a)). Such a with-clause can occur if
@@ -705,33 +733,9 @@ package body Lib.Writ is
or else (Ada_Version = Ada_83
and then Full_Source_Name (Body_Fname) /= No_File)
then
- -- Ensure that on platforms where the file names are not
- -- case sensitive, the recorded file name is in lower case.
-
- if not File_Names_Case_Sensitive then
- Get_Name_String (Body_Fname);
- To_Lower (Name_Buffer (1 .. Name_Len));
- Body_Fname := Name_Find;
- end if;
-
- Write_Info_Name (Body_Fname);
- Write_Info_Tab (49);
- Write_Info_Name
- (Lib_File_Name (Body_Fname, Body_Index));
+ Write_With_File_Names (Body_Fname, Body_Index);
else
- -- Ensure that on platforms where the file names are not
- -- case sensitive, the recorded file name is in lower case.
-
- if not File_Names_Case_Sensitive then
- Get_Name_String (Fname);
- To_Lower (Name_Buffer (1 .. Name_Len));
- Fname := Name_Find;
- end if;
-
- Write_Info_Name (Fname);
- Write_Info_Tab (49);
- Write_Info_Name
- (Lib_File_Name (Fname, Munit_Index (Unum)));
+ Write_With_File_Names (Fname, Munit_Index (Unum));
end if;
if Elab_Flags (Unum) then