From a95f708ec32470ae773950928c3fb1962d0ec86e Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Fri, 22 May 2015 10:35:33 +0000 Subject: [PATCH] sem_ch3.adb, [...]: Remove incorrect hyphen in non-binary. 2015-05-22 Robert Dewar * 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 --- gcc/ada/ChangeLog | 14 ++++++ gcc/ada/exp_ch4.adb | 12 ++--- gcc/ada/exp_util.adb | 5 +- gcc/ada/osint-c.adb | 111 +++++++++++++++++++++++++++++++++++-------- gcc/ada/osint-c.ads | 36 +++++++++++--- gcc/ada/osint.adb | 5 +- gcc/ada/osint.ads | 9 ++-- gcc/ada/s-expmod.ads | 4 +- gcc/ada/s-fatgen.adb | 4 +- gcc/ada/s-rannum.adb | 2 +- gcc/ada/sem_ch3.adb | 4 +- gcc/ada/sem_eval.adb | 4 +- gcc/ada/sem_intr.adb | 3 +- 13 files changed, 161 insertions(+), 52 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9e1d36fa58f..fd598d4af19 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2015-05-22 Robert Dewar + + * 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. + 2015-05-22 Robert Dewar * exp_ch4.adb: Minor rewording. diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 9cf4391798b..a2b938d311f 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -7674,7 +7674,7 @@ package body Exp_Ch4 is and then Esize (Root_Type (Exptyp)) <= Esize (Standard_Integer) -- This transformation is not applicable for a modular type with a - -- non-binary modulus because we do not handle modular reduction in + -- nonbinary modulus because we do not handle modular reduction in -- a correct manner if we attempt this transformation in this case. and then not Non_Binary_Modulus (Typ) @@ -7826,8 +7826,8 @@ package body Exp_Ch4 is if Is_Modular_Integer_Type (Rtyp) then - -- Non-binary case, we call the special exponentiation routine for - -- the non-binary case, converting the argument to Long_Long_Integer + -- Nonbinary case, we call the special exponentiation routine for + -- the nonbinary case, converting the argument to Long_Long_Integer -- and passing the modulus value. Then the result is converted back -- to the base type. @@ -9078,7 +9078,7 @@ package body Exp_Ch4 is -- where Bits is the shift count mod Esize (the mod operation here -- deals with ludicrous large shift counts, which are apparently OK). - -- What about non-binary modulus ??? + -- What about nonbinary modulus ??? declare Loc : constant Source_Ptr := Sloc (N); @@ -9131,7 +9131,7 @@ package body Exp_Ch4 is -- where Bits is the shift count mod Esize (the mod operation here -- deals with ludicrous large shift counts, which are apparently OK). - -- What about non-binary modulus ??? + -- What about nonbinary modulus ??? declare Loc : constant Source_Ptr := Sloc (N); @@ -9268,7 +9268,7 @@ package body Exp_Ch4 is -- to the word size, since in this case (not (Shift_Right (Mask, bits))) -- generates all 1'bits. - -- What about non-binary modulus ??? + -- What about nonbinary modulus ??? declare Loc : constant Source_Ptr := Sloc (N); diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index d7f98996330..ccb594b3987 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -2658,7 +2658,10 @@ package body Exp_Util is Next_Elmt (Prim); - -- Raise Program_Error if no primitive found + -- Raise Program_Error if no primitive found. ???This doesn't work as + -- advertised if there are no primitives. But fixing that breaks + -- Is_Init_Proc_Of in Exp_Ch7, which is expecting Empty in some + -- cases. if No (Prim) then raise Program_Error; diff --git a/gcc/ada/osint-c.adb b/gcc/ada/osint-c.adb index f955c2f34d3..6f53ae366e8 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 -- @@ -463,12 +524,24 @@ package body Osint.C is Tree_Write_Initialize (Output_FD); 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 -- ------------------------ diff --git a/gcc/ada/osint-c.ads b/gcc/ada/osint-c.ads index 0d6646ed3fa..550d4e58a71 100644 --- a/gcc/ada/osint-c.ads +++ b/gcc/ada/osint-c.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- 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- -- @@ -116,12 +116,6 @@ package Osint.C is -- information file for the main source file being compiled. See section -- above for a discussion of how library information files are stored. - procedure Set_Library_Info_Name; - -- Sets a default ALI file name from the main compiler source name. Used by - -- Create_Output_Library_Info, and by the version of Read_Library_Info that - -- takes a default file name. The name is in Name_Buffer (with length in - -- Name_Len) on return from the call. - procedure Create_Output_Library_Info; -- Creates the output library information file for the source file which -- is currently being compiled (i.e. the file which was most recently @@ -155,6 +149,34 @@ package Osint.C is -- text is returned in Text. If the file does not exist, then Text is -- set to null. + -------------------------- + -- C Translation Output -- + -------------------------- + + -- These routines are used by the compiler when the C translation option + -- is activated to write *.c and *.h files to the current object directory. + -- Each routine exists in a C and an H form for the two kinds of files. + -- Only one of these files can be written at a time. + + procedure Create_C_File; + procedure Create_H_File; + -- Creates the *.c or *.h file for the source file which is currently + -- being compiled (i.e. the file which was most recently returned by + -- Next_Main_Source). + + procedure Write_C_File_Info (Info : String); + procedure Write_H_File_Info (Info : String); + -- Writes the contents of the referenced string to the *.c or *.h file for + -- the main source file currently being compiled (i.e. the file which was + -- most recently opened with a call to Read_Next_File). Info represents + -- a line in the file with a line termination character at the end (which + -- is not present in the info string). + + procedure Close_C_File; + procedure Close_H_File; + -- Closes the file created by Create_C_File or Create_H file, flushing any + -- buffers etc. from writes by Write_C_File and Write_H_File; + ---------------------- -- List File Output -- ---------------------- diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index f78a8ea8ffd..6fc9071c887 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-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- -- @@ -3284,12 +3284,9 @@ package body Osint is procedure Write_With_Check (A : Address; N : Integer) is Ignore : Boolean; - pragma Warnings (Off, Ignore); - begin if N = Write (Output_FD, A, N) then return; - else Write_Str ("error: disk full writing "); Write_Name_Decoded (Output_File_Name); diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads index eb569c01e1f..5d25798f0dd 100644 --- a/gcc/ada/osint.ads +++ b/gcc/ada/osint.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-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- -- @@ -693,7 +693,8 @@ private -- The suffix used for the target object files Output_FD : File_Descriptor; - -- File descriptor for current library info, list, tree, or binder output + -- File descriptor for current library info, list, tree, C, H, or binder + -- output. Only one of these is open at a time, so we need only one FD. Output_File_Name : File_Name_Type; -- File_Name_Type for name of open file whose FD is in Output_FD, the name @@ -759,8 +760,8 @@ private -- for this file. This routine merely constructs the name. procedure Write_Info (Info : String); - -- Implementation of Write_Binder_Info, Write_Debug_Info and - -- Write_Library_Info (identical) + -- Implement Write_Binder_Info, Write_Debug_Info, Write_C_File_Info, + -- Write_H_File_Info, and Write_Library_Info (identical) procedure Write_With_Check (A : Address; N : Integer); -- Writes N bytes from buffer starting at address A to file whose FD is diff --git a/gcc/ada/s-expmod.ads b/gcc/ada/s-expmod.ads index df43c43f455..be7851bc4fa 100644 --- a/gcc/ada/s-expmod.ads +++ b/gcc/ada/s-expmod.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-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- -- @@ -29,7 +29,7 @@ -- -- ------------------------------------------------------------------------------ --- This function performs exponentiation of a modular type with non-binary +-- This function performs exponentiation of a modular type with nonbinary -- modulus values. Arithmetic is done in Long_Long_Unsigned, with explicit -- accounting for the modulus value which is passed as the second argument. -- Note that 1 is a binary modulus (2**0), so the compiler should not (and diff --git a/gcc/ada/s-fatgen.adb b/gcc/ada/s-fatgen.adb index b5cd9f56266..57703f4ff6e 100644 --- a/gcc/ada/s-fatgen.adb +++ b/gcc/ada/s-fatgen.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-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- -- @@ -30,7 +30,7 @@ ------------------------------------------------------------------------------ -- The implementation here is portable to any IEEE implementation. It does --- not handle non-binary radix, and also assumes that model numbers and +-- not handle nonbinary radix, and also assumes that model numbers and -- machine numbers are basically identical, which is not true of all possible -- floating-point implementations. On a non-IEEE machine, this body must be -- specialized appropriately, or better still, its generic instantiations diff --git a/gcc/ada/s-rannum.adb b/gcc/ada/s-rannum.adb index f722f6c0254..acebbaf8a6b 100644 --- a/gcc/ada/s-rannum.adb +++ b/gcc/ada/s-rannum.adb @@ -241,7 +241,7 @@ is -- integers. Assuming that Real'Machine_Radix = 2, it can deliver all -- machine values of type Real (as implied by Real'Machine_Mantissa and -- Real'Machine_Emin), which is not true of the standard method (to - -- which we fall back for non-binary radix): computing Real() / (+1). To do so, we first extract an -- (M-1)-bit significand (where M is Real'Machine_Mantissa), and then -- decide on a normalized exponent by repeated coin flips, decrementing diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 65c85762ef7..30c35c20a98 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -18490,7 +18490,7 @@ package body Sem_Ch3 is Set_Modular_Size (Bits); return; - -- Non-binary case + -- Nonbinary case elsif M_Val < 2 ** Bits then Check_SPARK_05_Restriction ("modulus should be a power of 2", T); @@ -18505,7 +18505,7 @@ package body Sem_Ch3 is return; else - -- In the non-binary case, set size as per RM 13.3(55) + -- In the nonbinary case, set size as per RM 13.3(55) Set_Modular_Size (Bits); return; diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index d01d458b2c7..ebfa49243c3 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -177,7 +177,7 @@ package body Sem_Eval is function From_Bits (B : Bits; T : Entity_Id) return Uint; -- Converts a bit string of length B'Length to a Uint value to be used for -- a target of type T, which is a modular type. This procedure includes the - -- necessary reduction by the modulus in the case of a non-binary modulus + -- necessary reduction by the modulus in the case of a nonbinary modulus -- (for a binary modulus, the bit string is the right length any way so all -- is well). @@ -2936,7 +2936,7 @@ package body Sem_Eval is begin -- Negation is equivalent to subtracting from the modulus minus one. -- For a binary modulus this is equivalent to the ones-complement of - -- the original value. For non-binary modulus this is an arbitrary + -- the original value. For a nonbinary modulus this is an arbitrary -- but consistent definition. if Is_Modular_Integer_Type (Typ) then diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb index 79f633a14ba..69a1d5ffd8d 100644 --- a/gcc/ada/sem_intr.adb +++ b/gcc/ada/sem_intr.adb @@ -434,8 +434,7 @@ package body Sem_Intr is return; elsif Non_Binary_Modulus (Typ1) then - Errint - ("shifts not allowed for non-binary modular types", Ptyp1, N); + Errint ("shifts not allowed for nonbinary modular types", Ptyp1, N); -- For modular type, modulus must be 2**8, 2**16, 2**32, or 2**64. -- Don't apply to generic types, since we may not have a modulus value. -- 2.30.2