This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch adds some missing legality checks on uses of aspect Import. These checks were performed properly in the presence of pragmas, but were incomplete when using aspects. Compiling q.ads must yield: q.ads:2:28: imported entities cannot have explicit initialization (RM 8.1 (24)) q.ads:6:24: no initialization allowed for declaration of "J" at line 5 q.ads:6:24: imported entities cannot be initialized (RM B.1(24)) q.ads:9:24: no initialization allowed for declaration of "K" at line 8 q.ads:9:24: imported entities cannot be initialized (RM B.1(24)) --- package Q is R : constant Integer := 42 with Import, Volatile; Q1 : constant := R*R + R*R; J : constant Integer := -999 with Volatile; pragma Import (Ada, J); K : Integer := 1123; pragma Import (Ada, K); end; Tested on x86_64-pc-linux-gnu, committed on trunk 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.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |