aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch13.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-08-01 12:15:59 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-08-01 12:15:59 +0200
commit8894aa20ff573ed8cc3d317199fbcbfbcd03c159 (patch)
tree2ad58359fd383b19cc1da5d950b502f3eb5a1b82 /gcc/ada/sem_ch13.adb
parent7b4ebba52333641f9f09c8079e1d73e9f638083f (diff)
downloadgcc-8894aa20ff573ed8cc3d317199fbcbfbcd03c159.zip
gcc-8894aa20ff573ed8cc3d317199fbcbfbcd03c159.tar.gz
gcc-8894aa20ff573ed8cc3d317199fbcbfbcd03c159.tar.bz2
[multiple changes]
2014-08-01 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb (Analyze_Aspect_Specifications, case Aspect_Import): Set Is_Imported flag at once, to simplify subsequent legality checks. Reject the aspect on an object whose declaration has an explicit initial value. * sem_prag.adb (Process_Import_Or_Interface): Use original node to check legality of an initial value for an imported entity. Set Is_Imported flag in case of error to prevent cascaded errors. Do not set the Is_Imported flag if the pragma comes from an aspect, because it is already done when analyzing the aspect. 2014-08-01 Emmanuel Briot <briot@adacore.com> * g-regpat.adb (Parse): Add support for non-capturing parenthesis. From-SVN: r213447
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r--gcc/ada/sem_ch13.adb17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 76c7a70..86a36ce 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -2915,6 +2915,21 @@ package body Sem_Ch13 is
-- that verifed that there was a matching convention
-- is now obsolete.
+ if A_Id = Aspect_Import then
+ Set_Is_Imported (E);
+
+ -- An imported entity cannot have an explicit
+ -- initialization.
+
+ if Nkind (N) = N_Object_Declaration
+ and then Present (Expression (N))
+ then
+ Error_Msg_N
+ ("imported entities cannot be initialized "
+ & "(RM B.1(24))", Expression (N));
+ end if;
+ end if;
+
goto Continue;
end if;
@@ -2930,7 +2945,7 @@ package body Sem_Ch13 is
and then Nkind (Parent (N)) /= N_Compilation_Unit
then
Error_Msg_N
- ("incorrect context for library unit aspect&", Id);
+ ("incorrect context for library unit aspect&", Id);
goto Continue;
end if;