aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-02-18 12:56:35 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-02-18 12:56:35 +0100
commit2c9f8c0afa20c14e19ecb3dc760bc4cdfe1ee66e (patch)
tree9117345bce17a4248ac27fba841550b41220d000 /gcc/ada/sem_util.adb
parent3b821fe9fe8ba49149509f4f7bea6353602ad2d2 (diff)
downloadgcc-2c9f8c0afa20c14e19ecb3dc760bc4cdfe1ee66e.zip
gcc-2c9f8c0afa20c14e19ecb3dc760bc4cdfe1ee66e.tar.gz
gcc-2c9f8c0afa20c14e19ecb3dc760bc4cdfe1ee66e.tar.bz2
[multiple changes]
2014-02-18 Robert Dewar <dewar@adacore.com> * cstand.adb (Build_Signed_Integer_Type): Minor change of formal from Int to Nat (Build_Unsigned_Integer_Type): New procedure (Create_Standard): Create new unsigned types. * exp_ch4.adb (Expand_N_Op_Mod): Expand mod in Modify_Tree_For_C mode (Expand_N_Reference): Removed, problematic and not needed for now. * exp_ch4.ads (Expand_N_Reference): Removed, problematic and not needed for now. * exp_util.ads, exp_util.adb (Power_Of_Two): New function. * expander.adb: Remove call to Expand_N_Reference (problematic, and not needed now). * sem_aux.ads, sem_aux.adb (Corresponding_Unsigned_Type): New function. * stand.adb: Read and write unsigned type entities. * stand.ads: Add new unsigned types. 2014-02-18 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch4.adb (Analyze_Call): Do not mark a function call as being inside an assertion expression as the flag is now removed. (Check_Ghost_Subprogram_Call): Do not query the In_Assertion_Expression flag as it is now removed, instead use a predicate function. * sem_elab.adb (Check_Internal_Call_Continue): Do not query the In_Assertion_Expression flag as it is now removed, instead use a predicate function. * sem_prag.ads: Add new table Assertion_Expression_Pragma. * sem_util.adb Add with and use clause for Sem_Prag. (In_Assertion_Expression_Pragma): New routine. * sem_util.ads (In_Assertion_Expression_Pragma): New routine. * sinfo.adb (In_Assertion_Expression): Removed. (Set_In_Assertion_Expression): Removed. * sinfo.ads Remove flag In_Assertion_Expression along with its use in nodes. (In_Assertion_Expression): Removed along with pragma Inline. (Set_In_Assertion_Expression): Removed along with pragma Inline. 2014-02-18 Sergey Rybin <rybin@adacore.com frybin> * gnat_ugn.texi: gnatpp section: add note that '-j' cannot be used together with '-r', '-rf' or '-rnb' options. 2014-02-18 Hristian Kirtchev <kirtchev@adacore.com> * sem_attr.adb (Analyze_Attribute): Comment and code reformatting. Use separate routines to check the legality of attribute 'Old in certain pragmas. Verify the use of 'Old, 'Result and locally declared entities within the prefix of 'Old. (Check_References_In_Prefix): New routine. (Check_Use_In_Contract_Cases): New routine. (Check_Use_In_Test_Case): New routine. From-SVN: r207843
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb49
1 files changed, 44 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2e79e11..37e0877 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -51,6 +51,7 @@ with Sem_Attr; use Sem_Attr;
with Sem_Ch8; use Sem_Ch8;
with Sem_Disp; use Sem_Disp;
with Sem_Eval; use Sem_Eval;
+with Sem_Prag; use Sem_Prag;
with Sem_Res; use Sem_Res;
with Sem_Type; use Sem_Type;
with Sinfo; use Sinfo;
@@ -8325,6 +8326,44 @@ package body Sem_Util is
return False;
end Implements_Interface;
+ ------------------------------------
+ -- In_Assertion_Expression_Pragma --
+ ------------------------------------
+
+ function In_Assertion_Expression_Pragma (N : Node_Id) return Boolean is
+ Par : Node_Id;
+ Prag : Node_Id := Empty;
+
+ begin
+ -- Climb the parent chain looking for an enclosing pragma
+
+ Par := N;
+ while Present (Par) loop
+ if Nkind (Par) = N_Pragma then
+ Prag := Par;
+ exit;
+
+ -- Precondition-like pragmas are expanded into if statements, check
+ -- the original node instead.
+
+ elsif Nkind (Original_Node (Par)) = N_Pragma then
+ Prag := Original_Node (Par);
+ exit;
+
+ -- Prevent the search from going too far
+
+ elsif Is_Body_Or_Package_Declaration (Par) then
+ return False;
+ end if;
+
+ Par := Parent (Par);
+ end loop;
+
+ return
+ Present (Prag)
+ and then Assertion_Expression_Pragma (Get_Pragma_Id (Prag));
+ end In_Assertion_Expression_Pragma;
+
-----------------
-- In_Instance --
-----------------
@@ -10537,11 +10576,11 @@ package body Sem_Util is
Expr := N;
Par := Parent (N);
while not Nkind_In (Par, N_If_Expression,
- N_Case_Expression,
- N_And_Then,
- N_Or_Else,
- N_In,
- N_Not_In)
+ N_Case_Expression,
+ N_And_Then,
+ N_Or_Else,
+ N_In,
+ N_Not_In)
loop
Expr := Par;
Par := Parent (Par);