From 8894aa20ff573ed8cc3d317199fbcbfbcd03c159 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 1 Aug 2014 12:15:59 +0200 Subject: [multiple changes] 2014-08-01 Ed Schonberg * 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 * g-regpat.adb (Parse): Add support for non-capturing parenthesis. From-SVN: r213447 --- gcc/ada/sem_ch13.adb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'gcc/ada/sem_ch13.adb') 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; -- cgit v1.1