The name of this routine is changed to Check_CPP_Type_Has_No_Defaults. This has no functional effect, so no further test required.
Tested on x86_64-pc-linux-gnu, committed on trunk 2011-12-22 Robert Dewar <de...@adacore.com> * sem_ch3.adb, sem_ch3.ads, sem_prag.adb: Minor code clean up.
Index: sem_ch3.adb =================================================================== --- sem_ch3.adb (revision 182615) +++ sem_ch3.adb (working copy) @@ -9640,37 +9640,39 @@ end loop; end Check_Completion; - -------------------- - -- Check_CPP_Type -- - -------------------- + ------------------------------------ + -- Check_CPP_Type_Has_No_Defaults -- + ------------------------------------ - procedure Check_CPP_Type (T : Entity_Id) is + procedure Check_CPP_Type_Has_No_Defaults (T : Entity_Id) is Tdef : constant Node_Id := Type_Definition (Declaration_Node (T)); Clist : Node_Id; Comp : Node_Id; begin + -- Obtain the component list + if Nkind (Tdef) = N_Record_Definition then Clist := Component_List (Tdef); - - else - pragma Assert (Nkind (Tdef) = N_Derived_Type_Definition); + else pragma Assert (Nkind (Tdef) = N_Derived_Type_Definition); Clist := Component_List (Record_Extension_Part (Tdef)); end if; + -- Check all components to ensure no default expressions + if Present (Clist) then Comp := First (Component_Items (Clist)); while Present (Comp) loop if Present (Expression (Comp)) then Error_Msg_N - ("component of imported 'C'P'P type cannot have" & - " default expression", Expression (Comp)); + ("component of imported 'C'P'P type cannot have " + & "default expression", Expression (Comp)); end if; Next (Comp); end loop; end if; - end Check_CPP_Type; + end Check_CPP_Type_Has_No_Defaults; ---------------------------- -- Check_Delta_Expression -- @@ -18130,7 +18132,7 @@ -- Check that components of imported CPP types do not have default -- expressions. - Check_CPP_Type (Full_T); + Check_CPP_Type_Has_No_Defaults (Full_T); end if; -- If the private view has user specified stream attributes, then so has Index: sem_ch3.ads =================================================================== --- sem_ch3.ads (revision 182615) +++ sem_ch3.ads (working copy) @@ -115,7 +115,7 @@ -- and errors are posted on that node, rather than on the declarations that -- require completion in the package declaration. - procedure Check_CPP_Type (T : Entity_Id); + procedure Check_CPP_Type_Has_No_Defaults (T : Entity_Id); -- Check that components of imported CPP type T do not have default -- expressions because the constructor (if any) is on the C++ side. Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 182615) +++ sem_prag.adb (working copy) @@ -4604,11 +4604,12 @@ elsif C = Convention_CPP and then (Is_Record_Type (Def_Id) - or else Ekind (Def_Id) = E_Incomplete_Type) + or else Ekind (Def_Id) = E_Incomplete_Type) then if Ekind (Def_Id) = E_Incomplete_Type then if Present (Full_View (Def_Id)) then Def_Id := Full_View (Def_Id); + else Error_Msg_N ("cannot import 'C'P'P type before full declaration seen", @@ -4650,7 +4651,7 @@ -- full view is analyzed (see Process_Full_View). if not Is_Private_Type (Def_Id) then - Check_CPP_Type (Def_Id); + Check_CPP_Type_Has_No_Defaults (Def_Id); end if; elsif Nkind (Parent (Def_Id)) = N_Incomplete_Type_Declaration then @@ -4662,8 +4663,8 @@ else Error_Pragma_Arg - ("second argument of pragma% must be object, subprogram" & - " or incomplete type", + ("second argument of pragma% must be object, subprogram " + & "or incomplete type", Arg2); end if;