diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-10 15:09:33 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-10 15:09:33 +0000 |
commit | 753d3808d3ba06909775c95936dc46b1343b0bac (patch) | |
tree | d84e0f24984fb57d8df8e6e6cf11bfab406ce96c | |
parent | f55ce1694e4f99105ae340c55ce4b591e2a9b59c (diff) | |
download | gcc-753d3808d3ba06909775c95936dc46b1343b0bac.tar.gz |
2013-09-10 Robert Dewar <dewar@adacore.com>
* switch-c.adb: Diagnose -gnatc given after -gnatRm.
* gnat_ugn.texi: Add documentation for -gnatRm.
* usage.adb: Minor reorganization (put style entries in proper
order) Document -gnatRm switch.
* sinfo.ads: Minor comment fix.
2013-09-10 Sergey Rybin <rybin@adacore.com frybin>
* tree_io.ads: Update ASIS_Version_Number.
2013-09-10 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb (Access_Subprogram_Declaration): Check whether the
designated type can appear in a parameterless call.
* sem_ch4.adb (Analyze_Call): Do not insert an explicit dereference
in the case of an indirect call through an access function that
returns an array type.
(Analyze_One_Call): Handle properly legal parameterless calls
whose result is indexed, in constructs of the for F.all (I)
* sem_ch6.ads (May_Need_Actuals): Make public, for use on access
to subprogram types.
* sem_res.adb (Resolve_Call): If the call is indirect, there is
no entity to set on the name in the call.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202461 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 16 | ||||
-rw-r--r-- | gcc/ada/opt.ads | 2 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch4.adb | 24 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.ads | 7 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 8 | ||||
-rw-r--r-- | gcc/ada/sinfo.ads | 6 | ||||
-rw-r--r-- | gcc/ada/switch-c.adb | 4 | ||||
-rw-r--r-- | gcc/ada/tree_io.ads | 4 | ||||
-rw-r--r-- | gcc/ada/usage.adb | 5 | ||||
-rw-r--r-- | gcc/ada/vms_data.ads | 15 |
13 files changed, 107 insertions, 19 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 159bdd19e02..5af322e667b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,29 @@ +2013-09-10 Robert Dewar <dewar@adacore.com> + + * switch-c.adb: Diagnose -gnatc given after -gnatRm. + * gnat_ugn.texi: Add documentation for -gnatRm. + * usage.adb: Minor reorganization (put style entries in proper + order) Document -gnatRm switch. + * sinfo.ads: Minor comment fix. + +2013-09-10 Sergey Rybin <rybin@adacore.com frybin> + + * tree_io.ads: Update ASIS_Version_Number. + +2013-09-10 Ed Schonberg <schonberg@adacore.com> + + * sem_ch3.adb (Access_Subprogram_Declaration): Check whether the + designated type can appear in a parameterless call. + * sem_ch4.adb (Analyze_Call): Do not insert an explicit dereference + in the case of an indirect call through an access function that + returns an array type. + (Analyze_One_Call): Handle properly legal parameterless calls + whose result is indexed, in constructs of the for F.all (I) + * sem_ch6.ads (May_Need_Actuals): Make public, for use on access + to subprogram types. + * sem_res.adb (Resolve_Call): If the call is indirect, there is + no entity to set on the name in the call. + 2013-09-10 Hristian Kirtchev <kirtchev@adacore.com> * aspects.adb: Add entries in the Has_Aspect_Specifications_Flag diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 4bf45940ae4..40ffc35dacd 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -4013,6 +4013,10 @@ been given, since these two switches are not compatible. It is also not allowed if a previous @code{-gnatc} switch has been given, since we must be generating code to be able to determine representation information. +@item ^-gnatRm[s]^/REPRESENTATION_INFO^ +Output convention and parameter passing mechanisms for all subprograms. +This form is also incompatible with the use of @code{-gnatc}. + @item -gnats @cindex @option{-gnats} (@command{gcc}) Syntax check only. @@ -7277,6 +7281,11 @@ discriminant. See source files @file{repinfo.ads/adb} in the output. If the switch is followed by an s (e.g.@: @option{-gnatR2s}), then the output is to a file with the name @file{^file.rep^file_REP^} where file is the name of the corresponding source file. + +@item -gnatRm[s] +This form of the switch controls output of subprogram conventions +and parameter passing mechanisms for all subprograms. A following +@code{s} means output to a file as described above. @end ifclear @ifset vms @item /REPRESENTATION_INFO @@ -7300,7 +7309,14 @@ If _FILE is added at the end of an option (e.g.@: @option{/REPRESENTATION_INFO=ARRAYS_FILE}), then the output is to a file with the name @file{file_REP} where file is the name of the corresponding source file. + +@item /REPRESENTATION_INFO=MECHANISMS +This qualifier form controls output of subprogram conventions +and parameter passing mechanisms for all subprograms. It is +possible to append _FILE as described above to cause information +to be written to a file. @end ifset + Note that it is possible for record components to have zero size. In this case, the component clause uses an obvious extension of permitted Ada syntax, for example @code{at 0 range 0 .. -1}. diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index a4cbafd3888..f515dc78605 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -861,7 +861,7 @@ package Opt is List_Representation_Info_To_File : Boolean := False; -- GNAT - -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3 to be + -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3/m to be -- written to file.rep (where file is the name of the source file) instead -- of stdout. For example, if file x.adb is compiled using -gnatR2s then -- representation info is written to x.adb.ref. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 36882bd8f04..b3f99c4aeb6 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1256,6 +1256,11 @@ package body Sem_Ch3 is end loop; end if; + -- Check whether an indirect call without actuals may be possible. This + -- is used when resolving calls whose result is then indexed. + + May_Need_Actuals (Desig_Type); + -- If the return type is incomplete, this is legal as long as the type -- is declared in the current scope and will be completed in it (rather -- than being part of limited view). diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index a03c46552be..5a43a8df2a3 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -1037,6 +1037,9 @@ package body Sem_Ch4 is -- function that returns a pointer_to_procedure which is the entity -- being called. Finally, F (X) may be a call to a parameterless -- function that returns a pointer to a function with parameters. + -- Note that if F return an access to subprogram whose designated + -- type is an array, F (X) cannot be interpreted as an indirect call + -- through the result of the call to F. elsif Is_Access_Type (Etype (Nam)) and then Ekind (Designated_Type (Etype (Nam))) = E_Subprogram_Type @@ -1047,6 +1050,8 @@ package body Sem_Ch4 is (Nkind (Parent (N)) /= N_Explicit_Dereference and then Is_Entity_Name (Nam) and then No (First_Formal (Entity (Nam))) + and then not + Is_Array_Type (Etype (Designated_Type (Etype (Nam)))) and then Present (Actuals))) then Nam_Ent := Designated_Type (Etype (Nam)); @@ -2998,7 +3003,9 @@ package body Sem_Ch4 is return; end if; - -- An indexing requires at least one actual + -- An indexing requires at least one actual.The name of the call cannot + -- be an implicit indirect call, so it cannot be a generated explicit + -- dereference. if not Is_Empty_List (Actuals) and then @@ -3007,7 +3014,11 @@ package body Sem_Ch4 is (Needs_One_Actual (Nam) and then Present (Next_Actual (First (Actuals))))) then - if Is_Array_Type (Subp_Type) then + if Is_Array_Type (Subp_Type) + and then + (Nkind (Name (N)) /= N_Explicit_Dereference + or else Comes_From_Source (Name (N))) + then Is_Indexed := Try_Indexed_Call (N, Nam, Subp_Type, Must_Skip); elsif Is_Access_Type (Subp_Type) @@ -3046,9 +3057,14 @@ package body Sem_Ch4 is if not Norm_OK then -- If an indirect call is a possible interpretation, indicate - -- success to the caller. + -- success to the caller. This may be an indecing of an explicit + -- dereference of a call that returns an access type (see above). - if Is_Indirect then + if Is_Indirect + or else (Is_Indexed + and then Nkind (Name (N)) = N_Explicit_Dereference + and then Comes_From_Source (Name (N))) + then Success := True; return; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 44ce304363b..e4ad78b8419 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -211,10 +211,6 @@ package body Sem_Ch6 is -- Create the declaration for an inequality operator that is implicitly -- created by a user-defined equality operator that yields a boolean. - procedure May_Need_Actuals (Fun : Entity_Id); - -- Flag functions that can be called without parameters, i.e. those that - -- have no parameters, or those for which defaults exist for all parameters - procedure Process_PPCs (N : Node_Id; Spec_Id : Entity_Id; diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads index 0799adc1849..d967c017ae0 100644 --- a/gcc/ada/sem_ch6.ads +++ b/gcc/ada/sem_ch6.ads @@ -234,6 +234,13 @@ package Sem_Ch6 is -- E is the entity for a subprogram or generic subprogram spec. This call -- lists all inherited Pre/Post aspects if List_Inherited_Pre_Post is True. + procedure May_Need_Actuals (Fun : Entity_Id); + -- Flag functions that can be called without parameters, i.e. those that + -- have no parameters, or those for which defaults exist for all parameters + -- Used for subprogram declarations and for access subprogram declarations, + -- where they apply to the anonymous designated type. On return the flag + -- Set_Needs_No_Actuals is set appropriately in Fun. + function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean; -- Determine whether two callable entities (subprograms, entries, -- literals) are mode conformant (RM 6.3.1(15)) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index e08370e7824..387e06f31db 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -5460,7 +5460,13 @@ package body Sem_Res is ("cannot disambiguate function call and indexing", N); else New_Subp := Relocate_Node (Subp); - Set_Entity (Subp, Nam); + + -- The called entity may be an explicit dereference, in which + -- case there is no entity to set. + + if Nkind (New_Subp) /= N_Explicit_Dereference then + Set_Entity (Subp, Nam); + end if; if (Is_Array_Type (Ret_Type) and then Component_Type (Ret_Type) /= Any_Type) diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 5af10be736e..37a6e14373f 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -7076,7 +7076,7 @@ package Sinfo is -- Pre_Post_Conditions contains a collection of pragmas that correspond -- to pre- and postconditions associated with an entry or a subprogram. -- The pragmas can either come from source or be the byproduct of aspect - -- expansion. The ordering in the list is of LIFO fashion. + -- expansion. The ordering in the list is in LIFO fashion. -- Note that there might be multiple preconditions or postconditions -- in this list, either because they come from separate pragmas in the @@ -7085,12 +7085,12 @@ package Sinfo is -- Contract_Test_Cases contains a collection of pragmas that correspond -- to aspects/pragmas Contract_Cases and Test_Case. The ordering in the - -- list is of LIFO fashion. + -- list is in LIFO fashion. -- Classifications contains pragmas that either categorize subprogram -- inputs and outputs or establish dependencies between them. Currently -- pragmas Depends and Global are stored in this list. The ordering is - -- of LIFO fashion. + -- in LIFO fashion. ------------------- -- Expanded_Name -- diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index cd647da818c..34d5b0887b2 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -312,7 +312,9 @@ package body Switch.C is -- Not allowed if previous -gnatR given - if List_Representation_Info /= 0 then + if List_Representation_Info /= 0 + or else List_Representation_Info_Mechanisms + then Osint.Fail ("-gnatc not allowed since -gnatR given previously"); end if; diff --git a/gcc/ada/tree_io.ads b/gcc/ada/tree_io.ads index 3692d1ec650..bab7f9e6a4a 100644 --- a/gcc/ada/tree_io.ads +++ b/gcc/ada/tree_io.ads @@ -47,7 +47,7 @@ package Tree_IO is Tree_Format_Error : exception; -- Raised if a format error is detected in the input file - ASIS_Version_Number : constant := 32; + ASIS_Version_Number : constant := 33; -- ASIS Version. This is used to check for consistency between the compiler -- used to generate trees and an ASIS application that is reading the -- trees. It must be incremented whenever a change is made to the tree @@ -62,6 +62,8 @@ package Tree_IO is -- 31 Remove read/write of Debug_Pragmas_Disabled/Debug_Pragmas_Enabled -- 32 Change the way entities are changed through Next_Entity field in -- the hierarchy of child units + -- 33 Add copying subtrees for rewriting infix calls of operator + -- functions for the corresponding original nodes. procedure Tree_Read_Initialize (Desc : File_Descriptor); -- Called to initialize reading of a tree file. This call must be made diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index dd0f2af33e4..ffcd7246905 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -381,7 +381,8 @@ begin -- Lines for -gnatR switch Write_Switch_Char ("R?"); - Write_Line ("List rep info (?=0/1/2/3 for none/types/all/variable)"); + Write_Line + ("List rep info (?=0/1/2/3/m for none/types/all/variable/mechanisms)"); Write_Switch_Char ("R?s"); Write_Line ("List rep info to file.rep instead of standard output"); @@ -626,8 +627,8 @@ begin Write_Line (" l check reference manual layout"); Write_Line (" Lnn check max nest level < nn "); Write_Line (" m check line length <= 79 characters"); - Write_Line (" n check casing of package Standard identifiers"); Write_Line (" Mnn check line length <= nn characters"); + Write_Line (" n check casing of package Standard identifiers"); Write_Line (" N turn off all checks"); Write_Line (" o check subprogram bodies in alphabetical order"); Write_Line (" O check overriding indicators"); diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads index 91ee51db119..f92788af69b 100644 --- a/gcc/ada/vms_data.ads +++ b/gcc/ada/vms_data.ads @@ -2299,7 +2299,11 @@ package VMS_Data is "SYMBOLIC " & "-gnatR3 " & "SYMBOLIC_FILE " & - "-gnatR3s"; + "-gnatR3s " & + "MECHANISMS " & + "-gnatRm " & + "MECHANISMS_FILE " & + "-gnatRms"; -- /NOREPRESENTATION_INFO (D) -- /REPRESENTATION_INFO[=(keyword[,...])] -- @@ -2330,6 +2334,13 @@ package VMS_Data is -- with the name 'file_rep' where 'file' is the name -- of the corresponding source file. -- + -- MECHANISMS List convention and argument passing mechanisms + -- for all subprograms + -- + -- MECHANISMS_FILE Similar to MECHANISMS, but the output is to a file + -- with the name 'file_rep' where file is the name + -- of the corresponding source file. + -- -- DEFAULT Equivalent to ARRAYS. S_GCC_RepinfX : aliased constant S := "/NOREPRESENTATION_INFO " & @@ -2491,7 +2502,7 @@ package VMS_Data is "XTRA_PARENS " & "-gnaty-x " & "NOXTRA_PARENS " & - "-gnaty-x "; + "-gnaty-x"; -- /NOSTYLE_CHECKS (D) -- /STYLE_CHECKS[=(keyword,[...])] -- |