]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 10 Sep 2010 09:11:44 +0000 (11:11 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 10 Sep 2010 09:11:44 +0000 (11:11 +0200)
2010-09-10  Robert Dewar  <dewar@adacore.com>

* einfo.adb: Minor code cleanup: Add assertion to
Set_Corresponding_Protected_Entry.

2010-09-10  Bob Duff  <duff@adacore.com>

* g-pehage.ads, g-pehage.adb (Produce): Add a new flag to allow sending
the output to standard output.

From-SVN: r164145

gcc/ada/ChangeLog
gcc/ada/einfo.adb
gcc/ada/g-pehage.adb
gcc/ada/g-pehage.ads

index 6822a1756c958c11eb9f485a70aae0e8ae9cb203..6e81788636a8213e1a4023e75013b5e9835dcd14 100644 (file)
@@ -1,3 +1,13 @@
+2010-09-10  Robert Dewar  <dewar@adacore.com>
+
+       * einfo.adb: Minor code cleanup: Add assertion to
+       Set_Corresponding_Protected_Entry.
+
+2010-09-10  Bob Duff  <duff@adacore.com>
+
+       * g-pehage.ads, g-pehage.adb (Produce): Add a new flag to allow sending
+       the output to standard output.
+
 2010-09-09  Vincent Celier  <celier@adacore.com>
 
        * gnat_ugn.texi: Add documentation for new gnatmake switch
index 231089548c25d0b53092fcdfc78245c81ec382be..24461c29db7cc7a55fc7bd8e2f762bc147b52be4 100644 (file)
@@ -3124,6 +3124,7 @@ package body Einfo is
 
    procedure Set_Corresponding_Protected_Entry (Id : E; V : E) is
    begin
+      pragma Assert (Ekind_In (Id, E_Void, E_Subprogram_Body));
       Set_Node18 (Id, V);
    end Set_Corresponding_Protected_Entry;
 
index 1b4801824414096dd6f6506c586d2c742a65d4ac..c637d1c0d0bb46c154a02507466540b7547b9870 100644 (file)
@@ -1431,8 +1431,11 @@ package body GNAT.Perfect_Hash_Generators is
    -- Produce --
    -------------
 
-   procedure Produce (Pkg_Name : String := Default_Pkg_Name) is
-      File : File_Descriptor;
+   procedure Produce
+     (Pkg_Name   : String  := Default_Pkg_Name;
+      Use_Stdout : Boolean := False)
+   is
+      File : File_Descriptor := Standout;
 
       Status : Boolean;
       --  For call to Close
@@ -1525,23 +1528,25 @@ package body GNAT.Perfect_Hash_Generators is
       P : Natural;
 
       FName : String := Ada_File_Base_Name (Pkg_Name) & ".ads";
-      --  Initially, the name of the spec file; then modified to be the name of
-      --  the body file.
+      --  Initially, the name of the spec file, then modified to be the name of
+      --  the body file. Not used if Use_Stdout is True.
 
    --  Start of processing for Produce
 
    begin
 
-      if Verbose then
+      if Verbose and then not Use_Stdout then
          Put (Output,
               "Producing " & Ada.Directories.Current_Directory & "/" & FName);
          New_Line (Output);
       end if;
 
-      File := Create_File (FName, Binary);
+      if not Use_Stdout then
+         File := Create_File (FName, Binary);
 
-      if File = Invalid_FD then
-         raise Program_Error with "cannot create: " & FName;
+         if File = Invalid_FD then
+            raise Program_Error with "cannot create: " & FName;
+         end if;
       end if;
 
       Put      (File, "package ");
@@ -1554,18 +1559,26 @@ package body GNAT.Perfect_Hash_Generators is
       Put      (File, Pkg_Name);
       Put      (File, ";");
       New_Line (File);
-      Close    (File, Status);
 
-      if not Status then
-         raise Device_Error;
+      if not Use_Stdout then
+         Close (File, Status);
+
+         if not Status then
+            raise Device_Error;
+         end if;
       end if;
 
-      FName (FName'Last) := 'b';  --  Set to body file name
+      if not Use_Stdout then
 
-      File := Create_File (FName, Binary);
+         --  Set to body file name
 
-      if File = Invalid_FD then
-         raise Program_Error with "cannot create: " & FName;
+         FName (FName'Last) := 'b';
+
+         File := Create_File (FName, Binary);
+
+         if File = Invalid_FD then
+            raise Program_Error with "cannot create: " & FName;
+         end if;
       end if;
 
       Put      (File, "with Interfaces; use Interfaces;");
@@ -1738,10 +1751,13 @@ package body GNAT.Perfect_Hash_Generators is
       Put      (File, Pkg_Name);
       Put      (File, ";");
       New_Line (File);
-      Close    (File, Status);
 
-      if not Status then
-         raise Device_Error;
+      if not Use_Stdout then
+         Close (File, Status);
+
+         if not Status then
+            raise Device_Error;
+         end if;
       end if;
    end Produce;
 
index dfe926ef78277ea0131aa7d285e6834a4d644fc2..c1954796eed704230418f2b5e4f4f47ffd9974b0 100644 (file)
@@ -131,11 +131,13 @@ package GNAT.Perfect_Hash_Generators is
    --  Raise Too_Many_Tries if the algorithm does not succeed within Tries
    --  attempts (see Initialize).
 
-   procedure Produce (Pkg_Name : String := Default_Pkg_Name);
+   procedure Produce
+     (Pkg_Name : String := Default_Pkg_Name; Use_Stdout : Boolean := False);
    --  Generate the hash function package Pkg_Name. This package includes the
-   --  minimal perfect Hash function. The output is placed in the current
-   --  directory, in files X.ads and X.adb, where X is the standard GNAT file
-   --  name for a package named Pkg_Name.
+   --  minimal perfect Hash function. The output is normally placed in the
+   --  current directory, in files X.ads and X.adb, where X is the standard
+   --  GNAT file name for a package named Pkg_Name. If Use_Stdout is True, the
+   --  output goes to standard output, and no files are written.
 
    ----------------------------------------------------------------