]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 10 Sep 2013 15:09:33 +0000 (17:09 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 10 Sep 2013 15:09:33 +0000 (17:09 +0200)
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.

From-SVN: r202461

13 files changed:
gcc/ada/ChangeLog
gcc/ada/gnat_ugn.texi
gcc/ada/opt.ads
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch6.ads
gcc/ada/sem_res.adb
gcc/ada/sinfo.ads
gcc/ada/switch-c.adb
gcc/ada/tree_io.ads
gcc/ada/usage.adb
gcc/ada/vms_data.ads

index 159bdd19e02b67f2be542e53b5aebd06cc1a1d87..5af322e667ba565d5a1446f41369feb2b089c1e4 100644 (file)
@@ -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
index 4bf45940ae463c10566ca53f4c206e8cc6d2f7ad..40ffc35dacdaa330b1e5ff75540c578aca809489 100644 (file)
@@ -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}.
index a4cbafd38880a8dd73ac4b544932f6111c7a949e..f515dc7860515cd8b84fa65b2c79ed35be9be9cd 100644 (file)
@@ -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.
index 36882bd8f04651567e86e2a2e823ff4fdf889cb2..b3f99c4aeb628009b4c0cbb69e1eb296b0082c22 100644 (file)
@@ -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).
index a03c46552be56e5417ae141ab91ca1abe1f983c6..5a43a8df2a32fd5c33577dfec1f45328390684bd 100644 (file)
@@ -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;
 
index 44ce304363be946a2d2e1ff65aa553afa93ac9a2..e4ad78b841982bbfe7f9262f1fc5d0e07be94dbf 100644 (file)
@@ -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;
index 0799adc184965fa8b211ace6e86f48cfd768bb63..d967c017ae05da353ff14a01dbf2568ab70eaa44 100644 (file)
@@ -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))
index e08370e782433afdaa64a02efc0f5f2b1ebeadc5..387e06f31db0afc9119f1fe295c619c924be96bf 100644 (file)
@@ -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)
index 5af10be736e7d129e1204e0d796c027b70cdf2a4..37a6e14373fe47767acb99e87522b6f998c3bb2f 100644 (file)
@@ -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 --
index cd647da818cb33bc230707dc25b59dcc43d5751d..34d5b0887b20681b651af33f7c4084538598a971 100644 (file)
@@ -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;
index 3692d1ec65045f7f6a2b051644f8ab8b2b96ca3d..bab7f9e6a4a97676eecd27d6d1a6b9f681a36074 100644 (file)
@@ -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
index dd0f2af33e4fef2b532ee8d62a0a62944682cb96..ffcd7246905b2a0924973ee94b191161e40a76ce 100644 (file)
@@ -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");
index 91ee51db11919cd1a1e7dc9a5ecbe9c325ffc968..f92788af69b892ac8e7d6f57384578fc0ff2e9d4 100644 (file)
@@ -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,[...])]
    --