summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-15 17:24:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-15 17:24:17 +0000
commitca14d7fa4e93eb368568f974f71e6c1d2eed481b (patch)
tree62222cc22dd847637e9f283dc7d0abbbcb358533 /gcc/ada/sem_attr.adb
parenta76d79d9b97d072a702e5c530d4103c877102c7c (diff)
downloadgcc-ca14d7fa4e93eb368568f974f71e6c1d2eed481b.tar.gz
2004-01-15 Olivier Hainque <hainque@act-europe.fr>
* decl.c (gnat_to_gnu_entity, E_Variable): Retrieve the object size also when not defining if a Size clause applies. That information is not to be ignored. 2004-01-15 Arnaud Charlet <charlet@act-europe.fr> * Makefile.in (install-gnatlib, gnatlib-shared-default): Set up symbolic links for the shared gnat run time when needed. 2004-01-15 Vasiliy Fofanov <fofanov@act-europe.fr> * memtrack.adb (Gmem_Initialize): check that gmem.out could be opened for writing, and terminate with an error message if not. 2004-01-15 Ed Schonberg <schonberg@gnat.com> * sem_attr.adb (Resolve_Attribute, case 'Access): Remove spurious warning on an access to subprogram in an instance, when the target type is declared in the same generic unit. (Eval_Attribute): If 'access is known to fail accessibility check, rewrite as a raise statement. 2004-01-15 GNAT Script <nobody@gnat.com> * Make-lang.in: Makefile automatically updated git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75931 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 3887181a225..51fd7c9c9c1 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2003, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2004, 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- --
@@ -4457,6 +4457,18 @@ package body Sem_Attr is
Compile_Time_Known_Attribute (N, Alignment (P_Entity));
return;
+ -- If this is an access attribute that is known to fail accessibility
+ -- check, rewrite accordingly.
+
+ elsif Attribute_Name (N) = Name_Access
+ and then Raises_Constraint_Error (N)
+ then
+ Rewrite (N,
+ Make_Raise_Program_Error (Loc,
+ Reason => PE_Accessibility_Check_Failed));
+ Set_Etype (N, C_Type);
+ return;
+
-- No other cases are foldable (they certainly aren't static, and at
-- the moment we don't try to fold any cases other than these three).
@@ -6501,6 +6513,9 @@ package body Sem_Attr is
null; -- Nothing to check
-- Check the static accessibility rule of 3.10.2(32)
+ -- In an instance body, if subprogram and type are both
+ -- local, other rules prevent dangling references, and no
+ -- warning is needed.
elsif Attr_Id = Attribute_Access
and then Subprogram_Access_Level (Entity (P))
@@ -6510,7 +6525,8 @@ package body Sem_Attr is
Error_Msg_N
("subprogram must not be deeper than access type",
P);
- else
+
+ elsif Scope (Entity (P)) /= Scope (Btyp) then
Error_Msg_N
("subprogram must not be deeper than access type?",
P);
@@ -6521,7 +6537,7 @@ package body Sem_Attr is
-- Check the restriction of 3.10.2(32) that disallows
-- the type of the access attribute to be declared
- -- outside a generic body when the attribute occurs
+ -- outside a generic body when the subprogram is declared
-- within that generic body.
elsif Enclosing_Generic_Body (Entity (P))