gnatfind.adb, [...]: Minor reformatting and code clean up.
authorRobert Dewar <dewar@adacore.com>
Mon, 27 Jul 2009 13:47:11 +0000 (13:47 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 27 Jul 2009 13:47:11 +0000 (15:47 +0200)
2009-07-27  Robert Dewar  <dewar@adacore.com>

* gnatfind.adb, osint.ads, sem.adb, xr_tabls.adb: Minor reformatting
and code clean up.

From-SVN: r150117

gcc/ada/ChangeLog
gcc/ada/gnatfind.adb
gcc/ada/osint.ads
gcc/ada/sem.adb
gcc/ada/xr_tabls.adb

index d886bdf5c242cc3fc5c85fe67b13fb5e8682f148..bd34c32f360c485102fc455fdce052350d70abee 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-27  Robert Dewar  <dewar@adacore.com>
+
+       * gnatfind.adb, osint.ads, sem.adb, xr_tabls.adb: Minor reformatting
+       and code clean up.
+
 2009-07-27  Ed Schonberg  <schonberg@adacore.com>
 
        * exp_ch9.adb (Expand_N_Timed_Entry_Call): Do not attempt expansion in
index 45bc5ee200540b41fc274ca5c564a816ed6f1f37..8af7b9e4f8b57e1bc6a55e87b097eb8a68e95997 100644 (file)
@@ -157,14 +157,13 @@ procedure Gnatfind is
 
             --  Only switch starting with -- recognized is --RTS
 
-            when '-'    =>
-
+            when '-' =>
                if GNAT.Command_Line.Full_Switch = "-RTS" then
+
                   --  Check that it is the first time we see this switch
 
                   if RTS_Specified = null then
                      RTS_Specified := new String'(GNAT.Command_Line.Parameter);
-
                   elsif RTS_Specified.all /= GNAT.Command_Line.Parameter then
                      Osint.Fail ("--RTS cannot be specified multiple times");
                   end if;
@@ -204,18 +203,21 @@ procedure Gnatfind is
                                       "adalib directory");
                      end if;
                   end;
+
+               --  Process -ext switch
+
                elsif GNAT.Command_Line.Full_Switch = "-ext" then
+
                   --  Check that it is the first time we see this switch
 
                   if EXT_Specified = null then
                      EXT_Specified := new String'(GNAT.Command_Line.Parameter);
-
                   elsif EXT_Specified.all /= GNAT.Command_Line.Parameter then
                      Osint.Fail ("--ext cannot be specified multiple times");
                   end if;
 
-                  if EXT_Specified'Length
-                    = Osint.ALI_Default_Suffix'Length
+                  if
+                    EXT_Specified'Length = Osint.ALI_Default_Suffix'Length
                   then
                      Osint.ALI_Suffix := EXT_Specified.all'Access;
                   else
index 5ddda479efbbed911c95c65d11e1b0b9bb7d8248..a44d4e24b3cb171a4fc252e526f853fb9381738f 100644 (file)
@@ -572,8 +572,8 @@ package Osint is
    --  Get length of argument
 
    ALI_Default_Suffix : constant String_Ptr := new String'("ali");
-   ALI_Suffix : String_Ptr := ALI_Default_Suffix;
-   --  The suffix used for the library files (also known as ALI files)
+   ALI_Suffix         : String_Ptr          := ALI_Default_Suffix;
+   --  The suffixes used for the library files (also known as ALI files)
 
 private
 
index 7411edeaa7f607cf12e9349a11c2662f4093bc87..b8ad571487e2a454c40c7514db4449415e10dc5d 100644 (file)
@@ -1873,13 +1873,12 @@ package body Sem is
             Main_CU : constant Node_Id := Cunit (Main_Unit);
 
          begin
-
-            --  If the main unit is an instantiation, the body appears
-            --  before the instance spec, which is added later to the
-            --  unit list. Do the spec if present, body will follow.
+            --  If the main unit is an instantiation, the body appears before
+            --  the instance spec, which is added later to the unit list. Do
+            --  the spec if present, body will follow.
 
             if Nkind (Original_Node (Unit (Main_CU)))
-            in N_Generic_Instantiation
+                 in N_Generic_Instantiation
               and then Present (Library_Unit (Main_CU))
             then
                Do_Unit_And_Dependents
@@ -1965,9 +1964,11 @@ package body Sem is
                   end loop;
 
                   --  See if it belongs to current unit, and if so, include its
-                  --  with_clauses.
+                  --  with_clauses. Do not process main unit prematurely.
 
-                  if Pnode = CU then
+                  if Pnode = CU
+                    and then (CU /= Cunit (Main_Unit))
+                  then
                      Walk_Immediate (Cunit (S), Include_Limited);
                   end if;
                end;
index 30a4ecc55a4e5390e660a15a23e0620ee0e95734..95bdfa985d87ffe7477dcd7696efa1dd10479960 100644 (file)
@@ -824,14 +824,14 @@ package body Xr_Tabls is
       end if;
 
       if File.Dir = null then
-         if Ada.Strings.Fixed.Tail (File.File.all, 3)
-           = Osint.ALI_Suffix.all
+         if Ada.Strings.Fixed.Tail (File.File.all, 3) =
+                                               Osint.ALI_Suffix.all
          then
             Tmp := Locate_Regular_File
-              (Internal_Strip (File.File.all), Directories.Obj_Dir);
+                     (Internal_Strip (File.File.all), Directories.Obj_Dir);
          else
             Tmp := Locate_Regular_File
-              (File.File.all, Directories.Src_Dir);
+                     (File.File.all, Directories.Src_Dir);
          end if;
 
          if Tmp = null then