OSDN Git Service

2011-09-02 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Sep 2011 07:10:07 +0000 (07:10 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Sep 2011 07:10:07 +0000 (07:10 +0000)
* sem_ch10.adb (Analyze_With_Clause): If the library unit
is the generated subprogram declaration for a child unit body
that acts as spec, use the original body in the with_clause,
to prevent binding errors.

2011-09-02  Vincent Celier  <celier@adacore.com>

* gnat_ugn.texi: Adapt documentation of -gnateInnn to new VMS
qualifier /MULTI_UNIT_INDEX=

2011-09-02  Johannes Kanig  <kanig@adacore.com>

* g-comlin.adb (Getopt): Return when switch is dealt with automatically,
instead of calling the callback function

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178435 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/g-comlin.adb
gcc/ada/g-comlin.ads
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch10.adb

index 936169a..4ab6922 100644 (file)
@@ -1,3 +1,20 @@
+2011-09-02  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch10.adb (Analyze_With_Clause): If the library unit
+       is the generated subprogram declaration for a child unit body
+       that acts as spec, use the original body in the with_clause,
+       to prevent binding errors.
+
+2011-09-02  Vincent Celier  <celier@adacore.com>
+
+       * gnat_ugn.texi: Adapt documentation of -gnateInnn to new VMS
+       qualifier /MULTI_UNIT_INDEX=
+
+2011-09-02  Johannes Kanig  <kanig@adacore.com>
+
+       * g-comlin.adb (Getopt): Return when switch is dealt with automatically,
+       instead of calling the callback function
+
 2011-09-02  Robert Dewar  <dewar@adacore.com>
 
        * prj-proc.adb, prj.ads, sem_util.adb, s-taprop-linux.adb,
index 5f5855f..43a6524 100644 (file)
@@ -3290,11 +3290,14 @@ package body GNAT.Command_Line is
                           with "Expected integer parameter for '"
                             & Switch & "'";
                   end;
+                  return;
 
                when Switch_String =>
                   Free (Config.Switches (Index).String_Output.all);
                   Config.Switches (Index).String_Output.all :=
                     new String'(Parameter);
+                  return;
+
             end case;
          end if;
 
index ec84280..f1b2163 100644 (file)
@@ -707,7 +707,8 @@ package GNAT.Command_Line is
       Callback : Switch_Handler := null;
       Parser   : Opt_Parser := Command_Line_Parser);
    --  Similar to the standard Getopt function.
-   --  For each switch found on the command line, this calls Callback.
+   --  For each switch found on the command line, this calls Callback, if the
+   --  switch is not handled automatically.
    --
    --  The list of valid switches are the ones from the configuration. The
    --  switches that were declared through Define_Switch with an Output
index 2a2618c..145c66e 100644 (file)
@@ -4130,11 +4130,11 @@ Display full source path name in brief error messages.
 @cindex @option{-gnateG} (@command{gcc})
 Save result of preprocessing in a text file.
 
-@item -gnateInnn
+@item ^-gnateI^/MULTI_UNIT_INDEX=^@var{nnn}
 @cindex @option{-gnateI} (@command{gcc})
 Indicates that the source is a multi-unit source and that the index of the
-unit to compile is nnn. nnn needs to be a positive number and need to
-be a valid index in the multi-unit source.
+unit to compile is @var{nnn}. @var{nnn} needs to be a positive number and need
+to be a valid index in the multi-unit source.
 
 @item -gnatem=@var{path}
 @cindex @option{-gnatem} (@command{gcc})
index 063da58..a0f0a79 100644 (file)
@@ -2536,6 +2536,21 @@ package body Sem_Ch10 is
          --  Child unit in a with clause
 
          Change_Selected_Component_To_Expanded_Name (Name (N));
+
+         --  If this is a child unit without a spec, and it has benn analyzed
+         --  already, a declaration has been created for it. The with_clause
+         --  must reflect the actual body, and not the generated declaration,
+         --  to prevent spurious binding errors involving an out-of-date spec.
+         --  Note that this can only happen if the unit includes more than one
+         --  with_clause for the child unit (e.g. in separate subunits).
+
+         if Unit_Kind = N_Subprogram_Declaration
+           and then Analyzed (Library_Unit (N))
+           and then not Comes_From_Source (Library_Unit (N))
+         then
+            Set_Library_Unit (N,
+               Cunit (Get_Source_Unit (Corresponding_Body (U))));
+         end if;
       end if;
 
       --  Restore style checks and restrictions