diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-06-14 11:26:32 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-06-14 11:26:32 +0200 |
commit | a50d57855134cc158154d694ef70df0020790aa9 (patch) | |
tree | 055b171a2b1f8340a0d798c1977eb41e2c6c9c32 /gcc | |
parent | 5d993afdcbc8174b8edc27911da2d371838b4c07 (diff) | |
download | gcc-a50d57855134cc158154d694ef70df0020790aa9.zip gcc-a50d57855134cc158154d694ef70df0020790aa9.tar.gz gcc-a50d57855134cc158154d694ef70df0020790aa9.tar.bz2 |
[multiple changes]
2010-06-14 Robert Dewar <dewar@adacore.com>
* gnatcmd.adb, sem_util.adb, exp_ch3.adb: Minor reformatting
2010-06-14 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Save_References): If an identifier has been rewritten
during analysis as an explicit dereference, keep the reference implicit
in the generic, but preserve the entity if global. This prevents
malformed generic trees in the presence of some nested generics.
2010-06-14 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: For the GNAT driver, clarify the effect of calling the
tool with '-files=' option. Also fix some small errors (wrong brackets)
From-SVN: r160716
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/ada/exp_ch3.adb | 2 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 17 | ||||
-rw-r--r-- | gcc/ada/gnatcmd.adb | 12 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.adb | 31 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 4 |
6 files changed, 58 insertions, 24 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5971f4f..af9bbd1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2010-06-14 Robert Dewar <dewar@adacore.com> + + * gnatcmd.adb, sem_util.adb, exp_ch3.adb: Minor reformatting + +2010-06-14 Ed Schonberg <schonberg@adacore.com> + + * sem_ch12.adb (Save_References): If an identifier has been rewritten + during analysis as an explicit dereference, keep the reference implicit + in the generic, but preserve the entity if global. This prevents + malformed generic trees in the presence of some nested generics. + +2010-06-14 Sergey Rybin <rybin@adacore.com> + + * gnat_ugn.texi: For the GNAT driver, clarify the effect of calling the + tool with '-files=' option. Also fix some small errors (wrong brackets) + 2010-06-14 Vincent Celier <celier@adacore.com> * gnatbind.adb: Call Scan_ALI with Directly_Scanned set to True for all diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 9420558..83fc7e3 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -593,7 +593,7 @@ package body Exp_Ch3 is ------------------------ function Init_One_Dimension (N : Int) return List_Id is - Index : Entity_Id; + Index : Entity_Id; begin -- If the component does not need initializing, then there is nothing diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 801d87b..b1831da 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -14799,9 +14799,9 @@ to @command{gnatmake} that the binder generated file should be compiled @noindent A number of GNAT tools, other than @command{^gnatmake^gnatmake^} can benefit from project files: -@command{^gnatbind^gnatbind^}, -@command{^gnatcheck^gnatcheck^}), -@command{^gnatclean^gnatclean^}), +(@command{^gnatbind^gnatbind^}, +@command{^gnatcheck^gnatcheck^}, +@command{^gnatclean^gnatclean^}, @command{^gnatelim^gnatelim^}, @command{^gnatfind^gnatfind^}, @command{^gnatlink^gnatlink^}, @@ -14809,7 +14809,7 @@ can benefit from project files: @command{^gnatmetric^gnatmetric^}, @command{^gnatpp^gnatpp^}, @command{^gnatstub^gnatstub^}, -and @command{^gnatxref^gnatxref^}. However, none of these tools can be invoked +and @command{^gnatxref^gnatxref^}). However, none of these tools can be invoked directly with a project file switch (@option{^-P^/PROJECT_FILE=^}). They must be invoked through the @command{gnat} driver. @@ -15085,8 +15085,8 @@ found in the package corresponding to the tool: except @code{^Switches^Switches^ ("main.adb")} for @code{^gnatlink^gnatlink^}. It is also possible to invoke some of the tools, -@code{^gnatcheck^gnatcheck^}), -@code{^gnatmetric^gnatmetric^}), +(@code{^gnatcheck^gnatcheck^}, +@code{^gnatmetric^gnatmetric^}, and @code{^gnatpp^gnatpp^}) on a set of project units thanks to the combination of the switches @option{-P}, @option{-U} and possibly the main unit when one is interested @@ -15106,7 +15106,10 @@ gnat metric -Pproj -U main_unit @end smallexample will compute the metrics for the closure of units rooted at @code{main_unit}. This last possibility relies implicitly -on @command{gnatbind}'s option @option{-R}. +on @command{gnatbind}'s option @option{-R}. But if the argument files for the +tool invoked by the the @command{gnat} driver are explicitly specified +either directly or through the tool @option{-files} option, then the tool +is called only for these explicitly specified files. @c ********************** @node An Extended Example diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index c462806..01685e3 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -318,8 +318,8 @@ procedure GNATCmd is -- there is a -files= switch. for Index in 1 .. Last_Switches.Last loop - if Last_Switches.Table (Index).all'Length > 7 and then - Last_Switches.Table (Index) (1 .. 7) = "-files=" + if Last_Switches.Table (Index).all'Length > 7 + and then Last_Switches.Table (Index) (1 .. 7) = "-files=" then Add_Sources := False; exit; @@ -353,13 +353,13 @@ procedure GNATCmd is end if; end loop; - -- If all arguments are switchesand there is no switch -files=, add the - -- path names of all the sources of the main project. + -- If all arguments are switches and there is no switch -files=, add + -- the path names of all the sources of the main project. if Add_Sources then - -- For gnatcheck, gnatpp and gnatmetric , create a temporary file and - -- put the list of sources in it. + -- For gnatcheck, gnatpp and gnatmetric , create a temporary file + -- and put the list of sources in it. if The_Command = Check or else The_Command = Pretty or else diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 174811b..29e1617 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -4848,8 +4848,13 @@ package body Sem_Ch12 is -- To detect this case we have to rescan the list of formals, which -- is usually short enough to ignore the resulting inefficiency. + ----------------------------- + -- Denotes_Previous_Actual -- + ----------------------------- + function Denotes_Previous_Actual (Typ : Entity_Id) return Boolean is Prev : Entity_Id; + begin Prev := First_Entity (Instance); while Present (Prev) loop @@ -4859,12 +4864,15 @@ package body Sem_Ch12 is and then Entity (Subtype_Indication (Parent (Prev))) = Typ then return True; + elsif Prev = E then return False; + else Next_Entity (Prev); end if; end loop; + return False; end Denotes_Previous_Actual; @@ -5874,7 +5882,7 @@ package body Sem_Ch12 is -- If we are not instantiating, then this is where we load and -- analyze subunits, i.e. at the point where the stub occurs. A - -- more permissible system might defer this analysis to the point + -- more permissive system might defer this analysis to the point -- of instantiation, but this seems to complicated for now. if not Instantiating then @@ -10480,10 +10488,18 @@ package body Sem_Ch12 is Collect_Previous_Instances (Private_Declarations (Specification (Decl))); + -- Previous non-generic bodies may contain instances as well + elsif Nkind (Decl) = N_Package_Body and then Ekind (Corresponding_Spec (Decl)) /= E_Generic_Package then Collect_Previous_Instances (Declarations (Decl)); + + elsif Nkind (Decl) = N_Subprogram_Body + and then not Acts_As_Spec (Decl) + and then not Is_Generic_Subprogram (Corresponding_Spec (Decl)) + then + Collect_Previous_Instances (Declarations (Decl)); end if; Next (Decl); @@ -12023,18 +12039,17 @@ package body Sem_Ch12 is elsif Nkind (N2) = N_Explicit_Dereference then -- An identifier is rewritten as a dereference if it is the - -- prefix in an implicit dereference. - - -- Check whether corresponding entity in prefix is global + -- prefix in an implicit dereference (call or attribute). + -- The analysis of an instantiation will expand the node + -- again, so we preserve the original tree but link it to + -- the resolved entity in case it is global. if Is_Entity_Name (Prefix (N2)) and then Present (Entity (Prefix (N2))) and then Is_Global (Entity (Prefix (N2))) then - Rewrite (N, - Make_Explicit_Dereference (Loc, - Prefix => - New_Occurrence_Of (Entity (Prefix (N2)), Loc))); + Set_Associated_Node (N, Prefix (N2)); + elsif Nkind (Prefix (N2)) = N_Function_Call and then Is_Global (Entity (Name (Prefix (N2)))) then diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e56066b..27ec8ab 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -543,8 +543,8 @@ package body Sem_Util is and then Is_Constrained (Root_Type (T))) and then not Has_Unknown_Discriminants (T) then - -- If the type of the dereference is already constrained, it - -- is an actual subtype. + -- If the type of the dereference is already constrained, it is an + -- actual subtype. if Is_Array_Type (Etype (N)) and then Is_Constrained (Etype (N)) |