mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-13 21:01:29 +08:00
[multiple changes]
2009-04-16 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Document effect of Assume_No_Invalid_Values and -gnatVa used together. 2009-04-16 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Find_Equality_Types): Filter out types that are not usable before calling Add_One_Interp, to resolve spurious ambiguities. From-SVN: r146163
This commit is contained in:
parent
fa702fbdb5
commit
a8e65aa5f2
@ -1,3 +1,13 @@
|
||||
2009-04-16 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* gnat_rm.texi: Document effect of Assume_No_Invalid_Values and -gnatVa
|
||||
used together.
|
||||
|
||||
2009-04-16 Ed Schonberg <schonberg@adacore.com>
|
||||
|
||||
* sem_ch4.adb (Find_Equality_Types): Filter out types that are not
|
||||
usable before calling Add_One_Interp, to resolve spurious ambiguities.
|
||||
|
||||
2009-04-16 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* Makefile.rtl: Add entries for s-conca?
|
||||
|
@ -1041,7 +1041,15 @@ value, and the loop above will be optimized away.
|
||||
The use of @code{Assume_No_Invalid_Values (On)} is appropriate if
|
||||
you know your code is free of uninitialized variables and other
|
||||
possible sources of invalid representations, and may result in
|
||||
more efficient code.
|
||||
more efficient code. A program that accesses an invalid representation
|
||||
with this pragma in effect is erroneous, so no guarantees can be made
|
||||
about its behavior.
|
||||
|
||||
It is peculiar though permissible to use this pragma in conjunction
|
||||
with validity checking (-gnatVa). In such cases, accessing invalid
|
||||
values will generally give an exception, though formally the program
|
||||
is erroneous so there are no guarantees that this will always be the
|
||||
case, and it is recommended that these two options not be used together.
|
||||
|
||||
@node Pragma Ast_Entry
|
||||
@unnumberedsec Pragma Ast_Entry
|
||||
|
@ -4697,17 +4697,19 @@ package body Sem_Ch4 is
|
||||
Scop : Entity_Id := Empty;
|
||||
|
||||
procedure Try_One_Interp (T1 : Entity_Id);
|
||||
-- The context of the operator plays no role in resolving the
|
||||
-- arguments, so that if there is more than one interpretation
|
||||
-- of the operands that is compatible with equality, the construct
|
||||
-- is ambiguous and an error can be emitted now, after trying to
|
||||
-- disambiguate, i.e. applying preference rules.
|
||||
-- The context of the equality operator plays no role in resolving the
|
||||
-- arguments, so that if there is more than one interpretation of the
|
||||
-- operands that is compatible with equality, the construct is ambiguous
|
||||
-- and an error can be emitted now, after trying to disambiguate, i.e.
|
||||
-- applying preference rules.
|
||||
|
||||
--------------------
|
||||
-- Try_One_Interp --
|
||||
--------------------
|
||||
|
||||
procedure Try_One_Interp (T1 : Entity_Id) is
|
||||
Bas : constant Entity_Id := Base_Type (T1);
|
||||
|
||||
begin
|
||||
-- If the operator is an expanded name, then the type of the operand
|
||||
-- must be defined in the corresponding scope. If the type is
|
||||
@ -4725,7 +4727,7 @@ package body Sem_Ch4 is
|
||||
or else T1 = Any_String
|
||||
or else T1 = Any_Composite
|
||||
or else (Ekind (T1) = E_Access_Subprogram_Type
|
||||
and then not Comes_From_Source (T1))
|
||||
and then not Comes_From_Source (T1))
|
||||
then
|
||||
null;
|
||||
|
||||
@ -4739,6 +4741,32 @@ package body Sem_Ch4 is
|
||||
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- If we have infix notation, the operator must be usable.
|
||||
-- Within an instance, if the type is already established we
|
||||
-- know it is correct.
|
||||
-- In Ada 2005, the equality on anonymous access types is declared
|
||||
-- in Standard, and is always visible.
|
||||
|
||||
elsif In_Open_Scopes (Scope (Bas))
|
||||
or else Is_Potentially_Use_Visible (Bas)
|
||||
or else In_Use (Bas)
|
||||
or else (In_Use (Scope (Bas))
|
||||
and then not Is_Hidden (Bas))
|
||||
or else (In_Instance
|
||||
and then First_Subtype (T1) = First_Subtype (Etype (R)))
|
||||
or else Ekind (T1) = E_Anonymous_Access_Type
|
||||
then
|
||||
null;
|
||||
|
||||
else
|
||||
-- Save candidate type for subsquent error message, if any.
|
||||
|
||||
if not Is_Limited_Type (T1) then
|
||||
Candidate_Type := T1;
|
||||
end if;
|
||||
|
||||
return;
|
||||
end if;
|
||||
|
||||
-- Ada 2005 (AI-230): Keep restriction imposed by Ada 83 and 95:
|
||||
|
Loading…
x
Reference in New Issue
Block a user