[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2014 13:28:35 +0000 (15:28 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2014 13:28:35 +0000 (15:28 +0200)
2014-08-01  Vincent Celier  <celier@adacore.com>

* debug.adb: Minor documentation addition for -dn switch.

2014-08-01  Robert Dewar  <dewar@adacore.com>

* sem_aggr.adb, exp_ch9.adb, sem_prag.adb, sem_util.adb,
sem_attr.adb, sem_eval.ads, sem_cat.adb, sem_ch13.adb: Improve
documentation of Is_Static_Expression vs Is_OK_Static_Expression.
In several places, use the Is_OK version as suggested by the spec.

2014-08-01  Vincent Celier  <celier@adacore.com>

* gnatcmd.adb: Revert last change which was not correct.

2014-08-01  Hristian Kirtchev  <kirtchev@adacore.com>

* freeze.adb (Find_Constant): Ensure that the constant being
inspected is still an object declaration (i.e. not a renaming).

From-SVN: r213458

gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/exp_ch9.adb
gcc/ada/freeze.adb
gcc/ada/gnatcmd.adb
gcc/ada/sem_aggr.adb
gcc/ada/sem_eval.ads
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb

index aa4d49c48b97f881df05973d5e7f55351ab5e7f9..d29f020193565c01ca884a543b91be2d17760972 100644 (file)
@@ -1,3 +1,23 @@
+2014-08-01  Vincent Celier  <celier@adacore.com>
+
+       * debug.adb: Minor documentation addition for -dn switch.
+
+2014-08-01  Robert Dewar  <dewar@adacore.com>
+
+       * sem_aggr.adb, exp_ch9.adb, sem_prag.adb, sem_util.adb,
+       sem_attr.adb, sem_eval.ads, sem_cat.adb, sem_ch13.adb: Improve
+       documentation of Is_Static_Expression vs Is_OK_Static_Expression.
+       In several places, use the Is_OK version as suggested by the spec.
+
+2014-08-01  Vincent Celier  <celier@adacore.com>
+
+       * gnatcmd.adb: Revert last change which was not correct.
+
+2014-08-01  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * freeze.adb (Find_Constant): Ensure that the constant being
+       inspected is still an object declaration (i.e. not a renaming).
+
 2014-08-01  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_ch5.adb (Analyze_Loop_Parameter_Specification): a)
index 715e44ad748810f7affa356e27448be41fab610b..94da7a6180e4096b2db0039894597ed9d30e6a00 100644 (file)
@@ -791,15 +791,15 @@ package body Debug is
 
    --  dm  Issue a message indicating the maximum number of simultaneous
    --      compilations.
-   --      Equivalent to --keep-temp-files.
 
    --  dn  Do not delete temporary files created by gnatmake at the end
    --      of execution, such as temporary config pragma files, mapping
-   --      files or project path files.
+   --      files or project path files. This debug switch is equivalent to
+   --      the standard switch --keep-temp-files. We retain the debug switch
+   --      for back compatibility with past usage.
 
    --  dp  Prints the Q used by routine Make.Compile_Sources every time
    --      we go around the main compile loop of Make.Compile_Sources
-   --      Equivalent to --keep-temp-files.
 
    --  dq  Prints source files as they are enqueued and dequeued in the Q
    --      used by routine Make.Compile_Sources. Useful to figure out the
@@ -822,7 +822,9 @@ package body Debug is
 
    --  dn  Do not delete temporary files created by gprbuild at the end
    --      of execution, such as temporary config pragma files, mapping
-   --      files or project path files.
+   --      files or project path files. This debug switch is equivalent to
+   --      the standard switch --keep-temp-files. We retain the debug switch
+   --      for back compatibility with past usage.
 
    --  dt  When a time stamp mismatch has been found for an ALI file,
    --      display the source file name, the time stamp expected and
index d01e849c88f69e415e34b9151198e7abb00ed836..e42c187a5c57a39d01e0fa0ec76d0516954b807a 100644 (file)
@@ -8929,7 +8929,7 @@ package body Exp_Ch9 is
 
          function Non_Static_Bound (Bound : Node_Id) return Boolean is
          begin
-            if Is_Static_Expression (Bound) then
+            if Is_OK_Static_Expression (Bound) then
                return False;
 
             elsif Is_Entity_Name (Bound)
index 9332930d96be2d808cee7edbecaf435a9bb7033e..b59e6ec29ea2573f03427b704627d69514a4328c 100644 (file)
@@ -1256,12 +1256,19 @@ package body Freeze is
 
       function Find_Constant (Nod : Node_Id) return Traverse_Result is
       begin
+         --  When a constant is initialized with the result of a dispatching
+         --  call, the constant declaration is rewritten as a renaming of the
+         --  displaced function result. This scenario is not a premature use of
+         --  a constant even though the Has_Completion flag is not set.
+
          if Is_Entity_Name (Nod)
            and then Present (Entity (Nod))
            and then Ekind (Entity (Nod)) = E_Constant
+           and then Scope (Entity (Nod)) = Current_Scope
+           and then Nkind (Declaration_Node (Entity (Nod))) =
+                                                         N_Object_Declaration
            and then not Is_Imported (Entity (Nod))
            and then not Has_Completion (Entity (Nod))
-           and then Scope (Entity (Nod)) = Current_Scope
          then
             Error_Msg_NE
               ("premature use of& in call or instance", N, Entity (Nod));
index 2e5bade8e36ea98eae1ec936f99e96ec00043beb..77cf6dc47ae88f06628ca91192c96efa86ad661e 100644 (file)
@@ -47,6 +47,7 @@ with Snames;   use Snames;
 with Stringt;
 with Switch;   use Switch;
 with Table;
+with Targparm; use Targparm;
 with Tempdir;
 with Types;    use Types;
 
@@ -57,9 +58,6 @@ with Ada.Text_IO;             use Ada.Text_IO;
 with GNAT.OS_Lib; use GNAT.OS_Lib;
 
 procedure GNATCmd is
-
-   AAMP_On_Target : Boolean := False;
-
    Normal_Exit : exception;
    --  Raise this exception for normal program termination
 
@@ -1185,7 +1183,7 @@ procedure GNATCmd is
          --  No usage for Sync
 
          if C /= Sync then
-            if AAMP_On_Target then
+            if Targparm.AAMP_On_Target then
                Put ("gnaampcmd ");
             else
                Put ("gnat ");
@@ -1590,7 +1588,8 @@ begin
    --  to handle the mapping of GNAAMP tool names. We don't extract it from
    --  system.ads, as there may be no default runtime.
 
-   AAMP_On_Target := To_Lower (Command_Name) = "gnaampcmd";
+   Find_Program_Name;
+   AAMP_On_Target := Name_Buffer (1 .. Name_Len) = "gnaampcmd";
 
    --  Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE,
    --  so that the spawned tool may know the way the GNAT driver was invoked.
index e5e236bc3c2c844086a4a179ea547bef4989a10c..2c450c572f10cd880f3b068ab4dae015db9eb5cb 100644 (file)
@@ -1732,7 +1732,7 @@ package body Sem_Aggr is
                              ("subtype& has dynamic predicate, not allowed "
                               & "in aggregate choice", Choice, E);
 
-                        elsif not Is_Static_Subtype (E) then
+                        elsif not Is_OK_Static_Subtype (E) then
                            Error_Msg_NE
                              ("non-static subtype& has predicate, not allowed "
                               & "in aggregate choice", Choice, E);
index 64d25295fae2595a7096b4bc9aeb703752a08666..72d0c995bd66a55007472b391975f946a339d9b3 100644 (file)
@@ -52,7 +52,12 @@ package Sem_Eval is
    --    Is_Static_Expression
 
    --      This flag is set on any expression that is static according to the
-   --      rules in (RM 4.9(3-32)).
+   --      rules in (RM 4.9(3-32)). This flag should be tested during testing
+   --      of legality of parts of a larger static expression. For all other
+   --      contexts that require static expressions, use the separate predicate
+   --      Is_OK_Static_Expression, since an expression that meets the RM 4.9
+   --      requirements, but raises a constraint error when evaluated in a non-
+   --      static context does not meet the legality requirements.
 
    --    Raises_Constraint_Error
 
index adcad24435ca89bad70e47ccca08c11a5e7685a2..da089301e419ab4c31163b3eaa6fcbd2e71fb7d2 100644 (file)
@@ -17757,7 +17757,7 @@ package body Sem_Prag is
 
                Preanalyze_Spec_Expression (Arg, RTE (RE_Any_Priority));
 
-               if not Is_Static_Expression (Arg) then
+               if not Is_OK_Static_Expression (Arg) then
                   Check_Restriction (Static_Priorities, Arg);
                end if;
 
index 6c385e0e7894f916a409db66589e4248f9e5e3dd..66967bee36192ca9b5724c70fe44be8d171aa1a9 100644 (file)
@@ -814,7 +814,7 @@ package body Sem_Util is
 
             if Nkind (Parent (N)) = N_Loop_Parameter_Specification
               and then not Has_Dynamic_Predicate_Aspect (Typ)
-              and then Is_Static_Subtype (Typ)
+              and then Is_OK_Static_Subtype (Typ)
             then
                return;
             end if;