This patch completes the implementation of Ada 2012 aspects on all renaming declarations. This is only relevant for implementation-defined aspects such as Warnings, as shown by the following example program which is compiled with -gnatwa -gnatld7
1. pragma Ada_2012; 2. procedure renameaspect is 3. Q : Integer with Warnings => Off; 4. R : Integer renames Q with Warnings => On; | >>> warning: renamed variable "R" is not referenced 5. X : Integer with Warnings => Off; 6. Y : Integer renames X with Warnings => Off; 7. begin 8. null; 9. end; Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-29 Robert Dewar <de...@adacore.com> * aspects.ads: Aspect Warnings is implementation defined Add some other missing entries to impl-defined list Mark Warnings as GNAT pragma in main list. * sem_ch8.adb: Process aspects for all cases of renaming declarations.
Index: aspects.ads =================================================================== --- aspects.ads (revision 195533) +++ aspects.ads (working copy) @@ -127,7 +127,7 @@ Aspect_Unsuppress, Aspect_Value_Size, -- GNAT Aspect_Variable_Indexing, - Aspect_Warnings, + Aspect_Warnings, -- GNAT Aspect_Write, -- The following aspects correspond to library unit pragmas @@ -234,6 +234,7 @@ Aspect_Favor_Top_Level => True, Aspect_Global => True, Aspect_Inline_Always => True, + Aspect_Invariant => True, Aspect_Lock_Free => True, Aspect_Object_Size => True, Aspect_Persistent_BSS => True, @@ -243,18 +244,19 @@ Aspect_Pure_12 => True, Aspect_Pure_Function => True, Aspect_Remote_Access_Type => True, + Aspect_Scalar_Storage_Order => True, Aspect_Shared => True, - Aspect_Scalar_Storage_Order => True, Aspect_Simple_Storage_Pool => True, Aspect_Simple_Storage_Pool_Type => True, Aspect_Suppress_Debug_Info => True, Aspect_Test_Case => True, + Aspect_Universal_Aliasing => True, Aspect_Universal_Data => True, - Aspect_Universal_Aliasing => True, Aspect_Unmodified => True, Aspect_Unreferenced => True, Aspect_Unreferenced_Objects => True, Aspect_Value_Size => True, + Aspect_Warnings => True, others => False); -- The following array indicates aspects for which multiple occurrences of Index: sem_ch8.adb =================================================================== --- sem_ch8.adb (revision 195533) +++ sem_ch8.adb (working copy) @@ -554,6 +554,14 @@ Set_Renamed_Object (Id, Entity (Nam)); end if; end if; + + -- Implementation-defined aspect specifications can appear in a renaming + -- declaration, but not language-defined ones. The call to procedure + -- Analyze_Aspect_Specifications will take care of this error check. + + if Has_Aspects (N) then + Analyze_Aspect_Specifications (N, Id); + end if; end Analyze_Exception_Renaming; --------------------------- @@ -681,6 +689,14 @@ Check_Library_Unit_Renaming (N, Old_P); end if; + + -- Implementation-defined aspect specifications can appear in a renaming + -- declaration, but not language-defined ones. The call to procedure + -- Analyze_Aspect_Specifications will take care of this error check. + + if Has_Aspects (N) then + Analyze_Aspect_Specifications (N, New_P); + end if; end Analyze_Generic_Renaming; ----------------------------- @@ -728,8 +744,7 @@ then null; - -- A renaming of an unchecked union does not have an - -- actual subtype. + -- A renaming of an unchecked union has no actual subtype elsif Is_Unchecked_Union (Typ) then null; @@ -800,9 +815,7 @@ -- when the renaming is generated in removing side effects of an -- already-analyzed expression. - if Nkind (Nam) = N_Selected_Component - and then Analyzed (Nam) - then + if Nkind (Nam) = N_Selected_Component and then Analyzed (Nam) then T := Etype (Nam); Dec := Build_Actual_Subtype_Of_Component (Etype (Nam), Nam); @@ -1235,6 +1248,17 @@ end if; Set_Renamed_Object (Id, Nam); + + -- Implementation-defined aspect specifications can appear in a renaming + -- declaration, but not language-defined ones. The call to procedure + -- Analyze_Aspect_Specifications will take care of this error check. + + if Has_Aspects (N) then + Analyze_Aspect_Specifications (N, Id); + end if; + + -- Deal with dimensions + Analyze_Dimension (N); end Analyze_Object_Renaming; @@ -1381,6 +1405,14 @@ end; end if; end if; + + -- Implementation-defined aspect specifications can appear in a renaming + -- declaration, but not language-defined ones. The call to procedure + -- Analyze_Aspect_Specifications will take care of this error check. + + if Has_Aspects (N) then + Analyze_Aspect_Specifications (N, New_P); + end if; end Analyze_Package_Renaming; -------------------------------