[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 20 Apr 2009 13:47:53 +0000 (15:47 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 20 Apr 2009 13:47:53 +0000 (15:47 +0200)
2009-04-20  Ed Schonberg  <schonberg@adacore.com>

* sem_ch8.adb (Use_One_Package): In an instance, if two
potentially_use_visible and non-overloadable homonyms are available
from  the actuals of distinct formal packages, retain the current one,
which was visible in the generic, to prevent spurious visibility
errors.
(End_Use_Package): Restore use_visibility when needed.

2009-04-20  Sergey Rybin  <rybin@adacore.com>

* gnat_ugn.texi, vms_data.ads: Update doc.

From-SVN: r146424

gcc/ada/ChangeLog
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch8.adb
gcc/ada/vms_data.ads

index 13f8261..9df0311 100644 (file)
@@ -1,3 +1,16 @@
+2009-04-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch8.adb (Use_One_Package): In an instance, if two
+       potentially_use_visible and non-overloadable homonyms are available
+       from  the actuals of distinct formal packages, retain the current one,
+       which was visible in the generic, to prevent spurious visibility
+       errors.
+       (End_Use_Package): Restore use_visibility when needed.
+
+2009-04-20  Sergey Rybin  <rybin@adacore.com>
+
+       * gnat_ugn.texi, vms_data.ads: Update doc.
+
 2009-04-20  Arnaud Charlet  <charlet@adacore.com>
 
        * gcc-interface/Make-lang.in: Update dependencies
index e9b5a66..541e6b1 100644 (file)
@@ -20346,9 +20346,11 @@ Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supp
 @noindent
 The @command{gnatcheck} tool outputs on @file{stdout} all messages concerning
 rule violations.
-It also creates, in the current
-directory, a text file named @file{^gnatcheck.out^GNATCHECK.OUT^} that
-contains the complete report of the last gnatcheck run. This report contains:
+It also creates a text file  that
+contains the complete report of the last gnatcheck run. By default this file is
+named named @file{^gnatcheck.out^GNATCHECK.OUT^} and it is located in the current
+directory, @option{^-o^/OUTPUT^} option can be used to change the name and/or
+location of the report file. This report contains:
 @itemize @bullet
 @item a list of the Ada source files being checked,
 @item a list of enabled and disabled rules,
@@ -20431,6 +20433,11 @@ in the report file
 Verbose mode; @command{gnatcheck} generates version information and then
 a trace of sources being processed.
 
+
+@cindex @option{^-o ^/OUTPUT^} (@command{gnatcheck})
+@item ^-o ^/OUTPUT=^@var{report_file}
+Set name of report file file to @var{report_file} .
+
 @end table
 
 @noindent
index ce31510..3f2ff18 100644 (file)
@@ -3362,8 +3362,23 @@ package body Sem_Ch8 is
       if Present (Hidden_By_Use_Clause (N)) then
          Elmt := First_Elmt (Hidden_By_Use_Clause (N));
          while Present (Elmt) loop
-            Set_Is_Immediately_Visible (Node (Elmt));
-            Next_Elmt (Elmt);
+            declare
+               E : constant Entity_Id := Node (Elmt);
+
+            begin
+               --  Reset either Use_Visibility or Direct_Visibility, depending
+               --  on how the entity was hidden by the use clause.
+
+               if In_Use (Scope (E))
+                 and then Used_As_Generic_Actual (Scope (E))
+               then
+                  Set_Is_Potentially_Use_Visible (Node (Elmt));
+               else
+                  Set_Is_Immediately_Visible (Node (Elmt));
+               end if;
+
+               Next_Elmt (Elmt);
+            end;
          end loop;
 
          Set_Hidden_By_Use_Clause (N, No_Elist);
@@ -7079,6 +7094,23 @@ package body Sem_Ch8 is
                          or else Chars (Prev) = Name_Op_Expon)
             then
                goto Next_Usable_Entity;
+
+            --  In an instance, two homonyms may become use_visible through the
+            --  actuals of distinct formal packages. In the generic, only the
+            --  current one would have been visible, so make the other one
+            --  not use_visible.
+
+            elsif Present (Current_Instance)
+              and then Is_Potentially_Use_Visible (Prev)
+              and then not Is_Overloadable (Prev)
+              and then Scope (Id) /= Scope (Prev)
+              and then Used_As_Generic_Actual (Scope (Prev))
+              and then Used_As_Generic_Actual (Scope (Id))
+              and then List_Containing (Current_Use_Clause (Scope (Prev))) /=
+                       List_Containing (Current_Use_Clause (Scope (Id)))
+            then
+               Set_Is_Potentially_Use_Visible (Prev, False);
+               Append_Elmt (Prev, Hidden_By_Use_Clause (N));
             end if;
 
             Prev := Homonym (Prev);
index 21529e0..d61a82e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1996-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 1996-2009, 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- --
@@ -875,6 +875,12 @@ package VMS_Data is
    --   copies of the gnat1 commands spawned to obtain the chop control
    --   information.
 
+   S_Check_Out  : aliased constant S := "/OUTPUT=@"                &
+                                             "-o@";
+   --        /OUTPUT=filename
+   --
+   --   Specify the name of the output file.
+
    Check_Switches : aliased constant Switches :=
                       (S_Check_Add      'Access,
                        S_Check_All      'Access,
@@ -890,7 +896,8 @@ package VMS_Data is
                        S_Check_Sections 'Access,
                        S_Check_Short    'Access,
                        S_Check_Subdirs  'Access,
-                       S_Check_Verb     'Access);
+                       S_Check_Verb     'Access,
+                       S_Check_Out      'Access);
 
    ----------------------------
    -- Switches for GNAT CHOP --