From e90e9503dff78ba8d3c31f01ef41ea8b75d953ee Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 19 Apr 2016 13:06:01 +0000 Subject: [PATCH] sem_res.adb (Within_Subprogram_Call): Detect also nodes that appear in entry calls. 2016-04-19 Arnaud Charlet * sem_res.adb (Within_Subprogram_Call): Detect also nodes that appear in entry calls. (Resolve_Actuals, Insert_Default): Propagate dimension information if any, from default expression to the copy that appears in the list of actuals. * uintp.ads: minor whitespace fix in comment. * sem_prag.adb, stringt.adb, inline.adb, lib-xref-spark_specific.adb: Minor code cleanup. * set_targ.adb (Set_Targ): convert directly from Natural to Pos, without intermediate conversion to Int. From-SVN: r235197 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/inline.adb | 2 +- gcc/ada/lib-xref-spark_specific.adb | 8 ++++---- gcc/ada/sem_prag.adb | 8 ++++---- gcc/ada/sem_res.adb | 9 +++++++-- gcc/ada/set_targ.adb | 8 ++++---- gcc/ada/stringt.adb | 2 +- gcc/ada/uintp.ads | 4 ++-- 8 files changed, 36 insertions(+), 18 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5f3e5c9bbd3..5be755baf5a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2016-04-19 Arnaud Charlet + + * sem_res.adb (Within_Subprogram_Call): Detect + also nodes that appear in entry calls. + (Resolve_Actuals, Insert_Default): Propagate + dimension information if any, from default expression to the + copy that appears in the list of actuals. + * uintp.ads: minor whitespace fix in comment. + * sem_prag.adb, stringt.adb, inline.adb, lib-xref-spark_specific.adb: + Minor code cleanup. + * set_targ.adb (Set_Targ): convert directly from + Natural to Pos, without intermediate conversion to Int. + 2016-04-19 Arnaud Charlet * sem_ch6.adb (Process_Formals): Mark suspicious reference to diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index b3b5aba21fe..7944604ae61 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -2242,7 +2242,7 @@ package body Inline is Lab_Decl : Node_Id; Lab_Id : Node_Id; New_A : Node_Id; - Num_Ret : Int := 0; + Num_Ret : Nat := 0; Ret_Type : Entity_Id; Targ : Node_Id; diff --git a/gcc/ada/lib-xref-spark_specific.adb b/gcc/ada/lib-xref-spark_specific.adb index f7409d9a916..dcd5e5620a1 100644 --- a/gcc/ada/lib-xref-spark_specific.adb +++ b/gcc/ada/lib-xref-spark_specific.adb @@ -870,8 +870,8 @@ package body SPARK_Specific is Line := 0; Col := 0; else - Line := Int (Get_Logical_Line_Number (Ref_Entry.Def)); - Col := Int (Get_Column_Number (Ref_Entry.Def)); + Line := Nat (Get_Logical_Line_Number (Ref_Entry.Def)); + Col := Nat (Get_Column_Number (Ref_Entry.Def)); end if; -- References to constant objects without variable inputs (see @@ -895,9 +895,9 @@ package body SPARK_Specific is Entity_Col => Col, File_Num => Dependency_Num (Ref.Lun), Scope_Num => Get_Scope_Num (Ref.Ref_Scope), - Line => Int (Get_Logical_Line_Number (Ref.Loc)), + Line => Nat (Get_Logical_Line_Number (Ref.Loc)), Rtype => Typ, - Col => Int (Get_Column_Number (Ref.Loc)))); + Col => Nat (Get_Column_Number (Ref.Loc)))); end; end loop; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 74c691539e5..e965976a691 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -6698,7 +6698,7 @@ package body Sem_Prag is declare Str : constant String_Id := Strval (Get_Pragma_Arg (Arg2)); - Len : constant Int := String_Length (Str); + Len : constant Nat := String_Length (Str); Cont : Boolean; Ptr : Nat; CC : Char_Code; @@ -21237,7 +21237,7 @@ package body Sem_Prag is Check_Arg_Count (1); if Nkind (A) = N_String_Literal then - S := Strval (A); + S := Strval (A); declare Slen : constant Natural := Natural (String_Length (S)); @@ -28802,10 +28802,10 @@ package body Sem_Prag is procedure Set_Encoded_Interface_Name (E : Entity_Id; S : Node_Id) is Str : constant String_Id := Strval (S); - Len : constant Int := String_Length (Str); + Len : constant Nat := String_Length (Str); CC : Char_Code; C : Character; - J : Int; + J : Pos; Hex : constant array (0 .. 15) of Character := "0123456789abcdef"; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 3fa505168ce..0bac1eb1816 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3379,6 +3379,10 @@ package body Sem_Res is New_Scope => Current_Scope, New_Sloc => Loc); + -- Propagate dimension information, if any. + + Copy_Dimensions (Default_Value (F), Actval); + if Is_Concurrent_Type (Scope (Nam)) and then Has_Discriminants (Scope (Nam)) then @@ -6882,7 +6886,7 @@ package body Sem_Res is -- Determine whether an arbitrary node appears in a check node function Within_Subprogram_Call (Nod : Node_Id) return Boolean; - -- Determine whether an arbitrary node appears in a procedure call + -- Determine whether an arbitrary node appears in a subprogram call function Within_Volatile_Function (Id : Entity_Id) return Boolean; -- Determine whether an arbitrary entity appears in a volatile @@ -6960,7 +6964,8 @@ package body Sem_Res is Par := Nod; while Present (Par) loop if Nkind_In (Par, N_Function_Call, - N_Procedure_Call_Statement) + N_Procedure_Call_Statement, + N_Entry_Call_Statement) then return True; diff --git a/gcc/ada/set_targ.adb b/gcc/ada/set_targ.adb index 4dbd735e97f..e83ccb41c4a 100755 --- a/gcc/ada/set_targ.adb +++ b/gcc/ada/set_targ.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2013-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 2013-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -946,21 +946,21 @@ begin T : FPT_Mode_Entry renames FPT_Mode_Table (FPT_Mode_Index_For (S_Float)); begin - Float_Size := Int (T.SIZE); + Float_Size := Pos (T.SIZE); end; declare T : FPT_Mode_Entry renames FPT_Mode_Table (FPT_Mode_Index_For (S_Long_Float)); begin - Double_Size := Int (T.SIZE); + Double_Size := Pos (T.SIZE); end; declare T : FPT_Mode_Entry renames FPT_Mode_Table (FPT_Mode_Index_For (S_Long_Long_Float)); begin - Long_Double_Size := Int (T.SIZE); + Long_Double_Size := Pos (T.SIZE); end; end if; diff --git a/gcc/ada/stringt.adb b/gcc/ada/stringt.adb index 5be78732cae..175b80c257d 100644 --- a/gcc/ada/stringt.adb +++ b/gcc/ada/stringt.adb @@ -241,7 +241,7 @@ package body Stringt is -- String_Chars table all at once. S_First : constant Int := Strings.Table (S).String_Index; - S_Len : constant Int := String_Length (S); + S_Len : constant Nat := String_Length (S); Old_Last : constant Int := String_Chars.Last; New_Last : constant Int := Old_Last + S_Len; diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads index 1d90524b9a2..a07fa083039 100644 --- a/gcc/ada/uintp.ads +++ b/gcc/ada/uintp.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -431,7 +431,7 @@ private -- Base is defined to allow efficient execution of the primitive operations -- (a0, b0, c0) defined in the section "The Classical Algorithms" - -- (sec. 4.3.1) of Donald Knuth's "The Art of Computer Programming", + -- (sec. 4.3.1) of Donald Knuth's "The Art of Computer Programming", -- Vol. 2. These algorithms are used in this package. In particular, -- the product of two single digits in this base fits in a 32-bit integer. -- 2.30.2