diff options
author | Robert Dewar <dewar@adacore.com> | 2015-05-22 10:35:33 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-22 12:35:33 +0200 |
commit | a95f708ec32470ae773950928c3fb1962d0ec86e (patch) | |
tree | fa4c9d7df72ccb3394febcf7e6ee1497f550fec9 /gcc/ada/osint-c.adb | |
parent | c2b2b2d7ab77e3c9ee9122b920c5c401151d0bca (diff) | |
download | gcc-a95f708ec32470ae773950928c3fb1962d0ec86e.zip gcc-a95f708ec32470ae773950928c3fb1962d0ec86e.tar.gz gcc-a95f708ec32470ae773950928c3fb1962d0ec86e.tar.bz2 |
sem_ch3.adb, [...]: Remove incorrect hyphen in non-binary.
2015-05-22 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb, sem_intr.adb, exp_ch4.adb, s-rannum.adb,
sem_eval.adb, s-fatgen.adb, s-expmod.ads: Remove incorrect hyphen in
non-binary.
* exp_util.adb: Add comment.
* osint-c.ads, osint-c.adb (Set_Library_Info_Name): Move from spec to
body.
(Set_File_Name): New name for the above.
(Create_C_File, Create_H_File, Write_C_File_Info, Write_H_File_Info,
Close_C_File, Close_H_File): New procedure.
* osint.adb: Minor reformatting.
* osint.ads: Minor comment updates.
From-SVN: r223540
Diffstat (limited to 'gcc/ada/osint-c.adb')
-rw-r--r-- | gcc/ada/osint-c.adb | 111 |
1 files changed, 92 insertions, 19 deletions
diff --git a/gcc/ada/osint-c.adb b/gcc/ada/osint-c.adb index f955c2f..6f53ae3 100644 --- a/gcc/ada/osint-c.adb +++ b/gcc/ada/osint-c.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2001-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -45,6 +45,30 @@ package body Osint.C is -- output file and Suffix is the desired suffix (dg/rep/xxx for debug/ -- repinfo/list file where xxx is specified extension. + procedure Set_File_Name (Ext : String); + -- Sets a default file name from the main compiler source name. Ext is + -- the extension, e.g. "ali" for a library information file. Used by + -- Create_Output_Library_Info, and by the version of Read_Library_Info that + -- takes a default file name, and also by Create_C_File and Create_H_File. + -- The name is in Name_Buffer (with length in Name_Len) on return. + + ------------------ + -- Close_C_File -- + ------------------ + + procedure Close_C_File is + Status : Boolean; + + begin + Close (Output_FD, Status); + + if not Status then + Fail + ("error while closing file " + & Get_Name_String (Output_File_Name)); + end if; + end Close_C_File; + ---------------------- -- Close_Debug_File -- ---------------------- @@ -62,6 +86,23 @@ package body Osint.C is end if; end Close_Debug_File; + ------------------ + -- Close_H_File -- + ------------------ + + procedure Close_H_File is + Status : Boolean; + + begin + Close (Output_FD, Status); + + if not Status then + Fail + ("error while closing file " + & Get_Name_String (Output_File_Name)); + end if; + end Close_H_File; + --------------------- -- Close_List_File -- --------------------- @@ -157,6 +198,18 @@ package body Osint.C is return Result; end Create_Auxiliary_File; + ------------------- + -- Create_C_File -- + ------------------- + + procedure Create_C_File is + Dummy : Boolean; + begin + Set_File_Name ("c"); + Delete_File (Name_Buffer (1 .. Name_Len), Dummy); + Create_File_And_Check (Output_FD, Text); + end Create_C_File; + ----------------------- -- Create_Debug_File -- ----------------------- @@ -166,17 +219,28 @@ package body Osint.C is return Create_Auxiliary_File (Src, "dg"); end Create_Debug_File; + ------------------- + -- Create_H_File -- + ------------------- + + procedure Create_H_File is + Dummy : Boolean; + begin + Set_File_Name ("h"); + Delete_File (Name_Buffer (1 .. Name_Len), Dummy); + Create_File_And_Check (Output_FD, Text); + end Create_H_File; + ---------------------- -- Create_List_File -- ---------------------- procedure Create_List_File (S : String) is - F : File_Name_Type; - pragma Warnings (Off, F); + Dummy : File_Name_Type; begin if S (S'First) = '.' then - F := Create_Auxiliary_File (Current_Main, S (S'First + 1 .. S'Last)); - + Dummy := + Create_Auxiliary_File (Current_Main, S (S'First + 1 .. S'Last)); else Name_Buffer (1 .. S'Length) := S; Name_Len := S'Length + 1; @@ -192,7 +256,7 @@ package body Osint.C is procedure Create_Output_Library_Info is Dummy : Boolean; begin - Set_Library_Info_Name; + Set_File_Name (ALI_Suffix.all); Delete_File (Name_Buffer (1 .. Name_Len), Dummy); Create_File_And_Check (Output_FD, Text); end Create_Output_Library_Info; @@ -203,7 +267,7 @@ package body Osint.C is procedure Open_Output_Library_Info is begin - Set_Library_Info_Name; + Set_File_Name (ALI_Suffix.all); Open_File_To_Append_And_Check (Output_FD, Text); end Open_Output_Library_Info; @@ -213,7 +277,6 @@ package body Osint.C is procedure Create_Repinfo_File (Src : String) is Discard : File_Name_Type; - pragma Warnings (Off, Discard); begin Name_Buffer (1 .. Src'Length) := Src; Name_Len := Src'Length; @@ -263,23 +326,21 @@ package body Osint.C is -- Read_Library_Info -- ----------------------- - -- Version with default file name - procedure Read_Library_Info (Name : out File_Name_Type; Text : out Text_Buffer_Ptr) is begin - Set_Library_Info_Name; + Set_File_Name (ALI_Suffix.all); Name := Name_Find; Text := Read_Library_Info (Name, Fatal_Err => False); end Read_Library_Info; - --------------------------- - -- Set_Library_Info_Name -- - --------------------------- + ------------------- + -- Set_File_Name -- + ------------------- - procedure Set_Library_Info_Name is + procedure Set_File_Name (Ext : String) is Dot_Index : Natural; begin @@ -372,10 +433,10 @@ package body Osint.C is end if; Name_Buffer (Dot_Index) := '.'; - Name_Buffer (Dot_Index + 1 .. Dot_Index + 3) := ALI_Suffix.all; - Name_Buffer (Dot_Index + 4) := ASCII.NUL; - Name_Len := Dot_Index + 3; - end Set_Library_Info_Name; + Name_Buffer (Dot_Index + 1 .. Dot_Index + Ext'Length) := Ext; + Name_Buffer (Dot_Index + Ext'Length + 1) := ASCII.NUL; + Name_Len := Dot_Index + Ext'Length + 1; + end Set_File_Name; --------------------------------- -- Set_Output_Object_File_Name -- @@ -464,11 +525,23 @@ package body Osint.C is end Tree_Create; ----------------------- + -- Write_C_File_Info -- + ----------------------- + + procedure Write_C_File_Info (Info : String) renames Write_Info; + + ----------------------- -- Write_Debug_Info -- ----------------------- procedure Write_Debug_Info (Info : String) renames Write_Info; + ----------------------- + -- Write_H_File_Info -- + ----------------------- + + procedure Write_H_File_Info (Info : String) renames Write_Info; + ------------------------ -- Write_Library_Info -- ------------------------ |