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 corrects two problems introduced by the previous patch to handle compilation unit specific restrictions. First if a subunit is compiled on its own, it does not pick up compilation unit specific restrictions from a configuration pragma file. Seccond, if such restrictions appear in the parent unit, they were improperly applied to subunits. The following two tests test both these cases with the following configuration pragmas file: 1. pragma Restrictions (No_Implementation_Attributes); 2. pragma Restrictions (SPARK); and the following sources: 1. procedure P is 2. procedure Q is separate; 3. begin 4. Q; 5. end; 1. separate (P) 2. procedure Q is 3. X : constant Integer := 0; 4. S : String := X'Img; 5. begin 6. null; 7. end Q; Then if we compile p.adb we get messages for both units: p.adb:5:04: violation of restriction "SPARK" at p.adc:2 "end P" required p-q.adb:4:04: violation of restriction "SPARK" at p.adc:2 declaration of object of unconstrained type not allowed p-q.adb:4:19: violation of restriction "No_Implementation_Attributes" at p.adc:1 If we compile the subunit on its own we get messages only for the subunit: p-q.adb:4:04: violation of restriction "SPARK" at p.adc:2 declaration of object of unconstrained type not allowed p-q.adb:4:19: violation of restriction "No_Implementation_Attributes" at p.adc:1 The second test tests the case of pragmas in the file: 1. pragma Restrictions (No_Implementation_Attributes); 2. pragma Restrictions (SPARK); 3. procedure R is 4. procedure Q is separate; 5. begin 6. Q; 7. end; 1. separate (R) 2. procedure Q is 3. X : constant Integer := 0; 4. S : String := X'Img; 5. begin 6. null; 7. end Q; If we compile the parent unit, we get only messages for the parent unit: 1. pragma Restrictions (No_Implementation_Attributes); 2. pragma Restrictions (SPARK); 3. procedure R is 4. procedure Q is separate; 5. begin 6. Q; 7. end; | >>> violation of restriction "SPARK" at line 2 >>> "end R" required If we compile the subunit, we still get messages only for the parent unit: Compiling: r-q.adb 1. separate (R) 2. procedure Q is 3. X : constant Integer := 0; 4. S : String := X'Img; 5. begin 6. null; 7. end Q; Compiling: r.adb 1. pragma Restrictions (No_Implementation_Attributes); 2. pragma Restrictions (SPARK); 3. procedure R is 4. procedure Q is separate; 5. begin 6. Q; 7. end; | >>> violation of restriction "SPARK" at line 2 >>> "end R" required Tested on x86_64-pc-linux-gnu, committed on trunk 2012-01-23 Robert Dewar <dewar@adacore.com> * sem_ch10.adb (Analyze_Subunit): Properly save/restore cunit restrictions.
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] |