diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:27:58 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-12-13 10:27:58 +0000 |
commit | 728d00964439c94e30977e82658ac5968fe59494 (patch) | |
tree | 507d79df94d7670b6e5e13cfbfac98aa4c16fd86 /gcc/ada/sem_aggr.adb | |
parent | d1cd50699d5b86a1fa1a9d924a6800d2f5453796 (diff) | |
download | gcc-728d00964439c94e30977e82658ac5968fe59494.tar.gz |
2007-12-06 Robert Dewar <dewar@adacore.com>
* g-spchge.ads, g-spchge.adb, g-u3spch.adb, g-u3spch.ads,
g-wispch.adb, g-wispch.ads, g-zspche.adb, g-zspche.ads,
namet-sp.adb, namet-sp.ads: New files.
* g-speche.adb: Use generic routine in g-spchge
* s-wchcnv.ads, s-wchcnv.adb:
Minor code cleanup (make formal type consistent with spec)
* namet.adb: Update comments.
* par-endh.adb (Evaluate_End_Entry): Use new
Namet.Sp.Is_Bad_Spelling_Of function
* par-load.adb (Load): Use new Namet.Sp.Is_Bad_Spelling_Of function
* sem_aggr.adb (Resolve_Record_Aggregate): If a component of an
ancestor is an access type initialized with a box, set its type
explicitly, for use in subsequent expansion.
(Check_Misspelled_Component): Use new Namet.Sp.Is_Bad_Spelling_Of
function
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130843 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_aggr.adb')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 73 |
1 files changed, 33 insertions, 40 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 3d5b62df4cf..f6ae6e56276 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -35,6 +35,7 @@ with Itypes; use Itypes; with Lib; use Lib; with Lib.Xref; use Lib.Xref; with Namet; use Namet; +with Namet.Sp; use Namet.Sp; with Nmake; use Nmake; with Nlists; use Nlists; with Opt; use Opt; @@ -55,8 +56,6 @@ with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; -with GNAT.Spelling_Checker; use GNAT.Spelling_Checker; - package body Sem_Aggr is type Case_Bounds is record @@ -730,44 +729,37 @@ package body Sem_Aggr is -- misspellings, these misspellings will be suggested as -- possible correction. - Get_Name_String (Chars (Component)); - - declare - S : constant String (1 .. Name_Len) := - Name_Buffer (1 .. Name_Len); - - begin - Component_Elmt := First_Elmt (Elements); - while Nr_Of_Suggestions <= Max_Suggestions - and then Present (Component_Elmt) - loop - Get_Name_String (Chars (Node (Component_Elmt))); - - if Is_Bad_Spelling_Of (Name_Buffer (1 .. Name_Len), S) then - Nr_Of_Suggestions := Nr_Of_Suggestions + 1; + Component_Elmt := First_Elmt (Elements); + while Nr_Of_Suggestions <= Max_Suggestions + and then Present (Component_Elmt) + loop + if Is_Bad_Spelling_Of + (Chars (Node (Component_Elmt)), + Chars (Component)) + then + Nr_Of_Suggestions := Nr_Of_Suggestions + 1; - case Nr_Of_Suggestions is - when 1 => Suggestion_1 := Node (Component_Elmt); - when 2 => Suggestion_2 := Node (Component_Elmt); - when others => exit; - end case; - end if; + case Nr_Of_Suggestions is + when 1 => Suggestion_1 := Node (Component_Elmt); + when 2 => Suggestion_2 := Node (Component_Elmt); + when others => exit; + end case; + end if; - Next_Elmt (Component_Elmt); - end loop; + Next_Elmt (Component_Elmt); + end loop; - -- Report at most two suggestions + -- Report at most two suggestions - if Nr_Of_Suggestions = 1 then - Error_Msg_NE ("\possible misspelling of&", - Component, Suggestion_1); + if Nr_Of_Suggestions = 1 then + Error_Msg_NE + ("\possible misspelling of&", Component, Suggestion_1); - elsif Nr_Of_Suggestions = 2 then - Error_Msg_Node_2 := Suggestion_2; - Error_Msg_NE ("\possible misspelling of& or&", - Component, Suggestion_1); - end if; - end; + elsif Nr_Of_Suggestions = 2 then + Error_Msg_Node_2 := Suggestion_2; + Error_Msg_NE + ("\possible misspelling of& or&", Component, Suggestion_1); + end if; end Check_Misspelled_Component; ---------------------------------------- @@ -3029,15 +3021,18 @@ package body Sem_Aggr is -- A box-defaulted access component gets the value null. Also -- included are components of private types whose underlying - -- type is an access type. + -- type is an access type. In either case set the type of the + -- literal, for subsequent use in semantic checks. elsif Present (Underlying_Type (Ctyp)) and then Is_Access_Type (Underlying_Type (Ctyp)) then if not Is_Private_Type (Ctyp) then + Expr := Make_Null (Sloc (N)); + Set_Etype (Expr, Ctyp); Add_Association (Component => Component, - Expr => Make_Null (Sloc (N))); + Expr => Expr); -- If the component's type is private with an access type as -- its underlying type then we have to create an unchecked @@ -3184,9 +3179,7 @@ package body Sem_Aggr is -- Ignore hidden components associated with the position of the -- interface tags: these are initialized dynamically. - if Present (Related_Interface (Component)) then - null; - else + if not Present (Related_Type (Component)) then Error_Msg_NE ("no value supplied for component &!", N, Component); end if; |