[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 5 Jul 2013 10:25:05 +0000 (12:25 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 5 Jul 2013 10:25:05 +0000 (12:25 +0200)
2013-07-05  Robert Dewar  <dewar@adacore.com>

* gnat_rm.texi: Add missing documentation for pragmas.
* sem_ch8.adb: Minor reformatting.
* gnat_ugn.texi: Document that -gnatR and -gnatD cannot be used
together.

2013-07-05  Yannick Moy  <moy@adacore.com>

* sem_ch12.ads, sem_ch12.adb (Need_Subprogram_Instance_Body): Force
instance of subprogram body in SPARK mode, by testing Expander_Active
(set in SPARK mode) instead of Full_Expander_Active (not set in
SPARK mode).
* sem_ch8.adb: Minor reformatting.

From-SVN: r200700

gcc/ada/ChangeLog
gcc/ada/gnat_rm.texi
gcc/ada/gnat_ugn.texi
gcc/ada/sem_ch12.adb
gcc/ada/sem_ch12.ads
gcc/ada/sem_ch8.adb

index 2c1f914..72d6bb4 100644 (file)
@@ -1,5 +1,20 @@
 2013-07-05  Robert Dewar  <dewar@adacore.com>
 
+       * gnat_rm.texi: Add missing documentation for pragmas.
+       * sem_ch8.adb: Minor reformatting.
+       * gnat_ugn.texi: Document that -gnatR and -gnatD cannot be used
+       together.
+
+2013-07-05  Yannick Moy  <moy@adacore.com>
+
+       * sem_ch12.ads, sem_ch12.adb (Need_Subprogram_Instance_Body): Force
+       instance of subprogram body in SPARK mode, by testing Expander_Active
+       (set in SPARK mode) instead of Full_Expander_Active (not set in
+       SPARK mode).
+       * sem_ch8.adb: Minor reformatting.
+
+2013-07-05  Robert Dewar  <dewar@adacore.com>
+
        * freeze.adb (Freeze_Entity): Remove test of obsolete flag
        Propagate_Exceptions, and associated useless code that did
        nothing.
index cb559a3..67ba282 100644 (file)
@@ -195,12 +195,14 @@ Implementation Defined Pragmas
 * Pragma Optimize_Alignment::
 * Pragma Ordered::
 * Pragma Overflow_Mode::
+* Pragma Overriding_Renamings::
 * Pragma Partition_Elaboration_Policy::
 * Pragma Passive::
 * Pragma Persistent_BSS::
 * Pragma Polling::
 * Pragma Postcondition::
 * Pragma Precondition::
+* Pragma Predicate::
 * Pragma Preelaborable_Initialization::
 * Pragma Preelaborate_05::
 * Pragma Priority_Specific_Dispatching::
@@ -1006,6 +1008,7 @@ consideration, the use of these pragmas should be minimized.
 * Pragma Polling::
 * Pragma Postcondition::
 * Pragma Precondition::
+* Pragma Predicate::
 * Pragma Preelaborable_Initialization::
 * Pragma Preelaborate_05::
 * Pragma Priority_Specific_Dispatching::
@@ -4727,6 +4730,7 @@ overflow checking, but does not affect the overflow mode.
 @unnumberedsec Pragma Overriding_Renamings
 @findex Overriding_Renamings
 @cindex Rational profile
+@cindex Rational compatibility
 @noindent
 Syntax:
 
@@ -4735,10 +4739,23 @@ pragma Overriding_Renamings;
 @end smallexample
 
 @noindent
-
-This is a GNAT pragma to simplify porting legacy code accepted by the Rational
+This is a GNAT configuration pragma to simplify porting
+legacy code accepted by the Rational
 Ada compiler. In the presence of this pragma, a renaming declaration that
-renames an inherited operation declared in the same scope is legal, even though
+renames an inherited operation declared in the same scope is legal if selected
+notation is used as in:
+
+@smallexample @c ada
+pragma Overriding_Renamings;
+...
+package R is
+  function F (..);
+  ...
+  function F (..) renames R.F;
+end R;
+@end smallexample
+
+even though
 RM 8.3 (15) stipulates that an overridden operation is not visible within the
 declaration of the overriding operation.
 
@@ -5059,6 +5076,47 @@ inlining (-gnatN option set) are accepted and legality-checked
 by the compiler, but are ignored at run-time even if precondition
 checking is enabled.
 
+@node Pragma Predicate
+@unnumberedsec Pragma Predicate
+@findex Predicate
+@findex Predicate pragma
+@noindent
+Syntax:
+
+@smallexample @c ada
+pragma Predicate
+  ([Entity =>] type_LOCAL_NAME,
+   [Check  =>] EXPRESSION);
+@end smallexample
+
+@noindent
+This pragma (available in all versions of Ada in GNAT) encompasses both
+the @code{Static_Predicate} and @code{Dynamic_Predicate} aspects in
+Ada 2012. A predicate is regarded as static if it has an allowed form
+for @code{Static_Predicate} and is otherwise treated as a
+@code{Dynamic_Predicate}. Otherwise, predicates specified by this
+pragma behave exactly as described in the Ada 2012 reference manual.
+For example, if we have
+
+@smallexample @c ada
+type R is range 1 .. 10;
+subtype S is R;
+pragma Predicate (Entity => S, Check => S not in 4 .. 6);
+subtype Q is R
+pragma Predicate (Entity => Q, Check => F(Q) or G(Q));
+@end smallexample
+
+@noindent
+the effect is identical to the following Ada 2012 code:
+
+@smallexample @c ada
+type R is range 1 .. 10;
+subtype S is R with
+  Static_Predicate => S not in 4 .. 6;
+subtype Q is R with
+  Dynamic_Predicate => F(Q) or G(Q);
+@end smallexample
+
 @node Pragma Preelaborable_Initialization
 @unnumberedsec Pragma Preelaborable_Initialization
 @findex Preelaborable_Initialization
index af5209c..da16217 100644 (file)
@@ -3726,7 +3726,8 @@ users guide.
 @end ifset
 Create expanded source files for source level debugging. This switch
 also suppress generation of cross-reference information
-(see @option{-gnatx}).
+(see @option{-gnatx}). Note that this switch is not allowed if a previous
+-gnatR switch has been given, since these two switches are not compatible.
 
 @item ^-gnateA^/ALIASING_CHECK^
 @cindex @option{-gnateA} (@command{gcc})
@@ -4005,6 +4006,8 @@ Treat pragma Restrictions as Restriction_Warnings.
 @item ^-gnatR@r{[}0@r{/}1@r{/}2@r{/}3@r{[}s@r{]]}^/REPRESENTATION_INFO^
 @cindex @option{-gnatR} (@command{gcc})
 Output representation information for declared types and objects.
+Note that this switch is not allowed if a previous
+-gnatD switch has been given, since these two switches are not compatible.
 
 @item -gnats
 @cindex @option{-gnats} (@command{gcc})
index 6749f2e..64e75cf 100644 (file)
@@ -4367,13 +4367,17 @@ package body Sem_Ch12 is
       Subp : Entity_Id) return Boolean
    is
    begin
+      --  This complex conditional requires blow by blow comments ???
+
       if (Is_In_Main_Unit (N)
            or else Is_Inlined (Subp)
            or else Is_Inlined (Alias (Subp)))
         and then (Operating_Mode = Generate_Code
                    or else (Operating_Mode = Check_Semantics
                              and then ASIS_Mode))
-        and then (Full_Expander_Active or else ASIS_Mode)
+        --  The following line definitely requires comments, why do we
+        --  test Expander_Active and not Full_Expander_Active here ???
+        and then (Expander_Active or ASIS_Mode)
         and then not ABE_Is_Certain (N)
         and then not Is_Eliminated (Subp)
       then
index 3fe88c9..450237b 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2013, 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- --
@@ -113,7 +113,6 @@ package Sem_Ch12 is
    function Need_Subprogram_Instance_Body
      (N    : Node_Id;
       Subp : Entity_Id) return Boolean;
-
    --  If a subprogram instance is inlined, indicate that the body of it
    --  must be created, to be used in inlined calls by the back-end. The
    --  subprogram may be inlined because the generic itself carries the
index 4fdef1c..1fbcf68 100644 (file)
@@ -2816,7 +2816,7 @@ package body Sem_Ch8 is
 
          --  The following is illegal, because F hides whatever other F may
          --  be around:
-         --     function F (.. renames F;
+         --     function F (...) renames F;
 
          elsif Old_S = New_S
            or else (Nkind (Nam) /= N_Expanded_Name
@@ -2824,6 +2824,10 @@ package body Sem_Ch8 is
          then
             Error_Msg_N ("subprogram cannot rename itself", N);
 
+         --  This is illegal even if we use a selector:
+         --     function F (...) renames Pkg.F;
+         --  because F is still hidden.
+
          elsif Nkind (Nam) = N_Expanded_Name
            and then Entity (Prefix (Nam)) = Current_Scope
            and then Chars (Selector_Name (Nam)) = Chars (New_S)