diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-05 10:25:05 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-07-05 10:25:05 +0000 |
commit | 1ff773267eaf30dcbfa3a63fcb8eac1a37c91d1e (patch) | |
tree | 0ae15f5205f8ee1f101620572d74673b26372b63 | |
parent | a2714a725d5a8f412e7908d7622db5207e7e0212 (diff) | |
download | gcc-1ff773267eaf30dcbfa3a63fcb8eac1a37c91d1e.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200700 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 64 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 5 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.adb | 6 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.ads | 3 | ||||
-rw-r--r-- | gcc/ada/sem_ch8.adb | 6 |
6 files changed, 91 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 2c1f91464c1..72d6bb40f14 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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. diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index cb559a320c7..67ba282793d 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -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 diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index af5209c5f8b..da16217fe29 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -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}) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 6749f2e436b..64e75cf6e42 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -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 diff --git a/gcc/ada/sem_ch12.ads b/gcc/ada/sem_ch12.ads index 3fe88c96ae7..450237be243 100644 --- a/gcc/ada/sem_ch12.ads +++ b/gcc/ada/sem_ch12.ads @@ -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 diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 4fdef1cdac2..1fbcf685a3d 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -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) |