From 0fe797c5849ca33b50a69995ce5aaccb1476ec8a Mon Sep 17 00:00:00 2001 From: Steve Baird Date: Thu, 12 Nov 2015 10:44:37 +0000 Subject: [PATCH] 2015-11-12 Steve Baird * sem_ch6.adb (Analyze_Procedure_Call) If CodePeer_Mode is True, do not analyze the expression of a machine code insertion. * sem_ch13.adb (Analyze_Code_Statement) If CodePeer_Mode is True, mark the N_Code_Statement node as analyzed and do nothing else. From-SVN: r230225 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sem_ch13.adb | 18 +++++++++++++----- gcc/ada/sem_ch6.adb | 18 ++++++++++++------ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3e98a5d5502..5144c2d2ba2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2015-11-12 Steve Baird + + * sem_ch6.adb (Analyze_Procedure_Call) If CodePeer_Mode is True, + do not analyze the expression of a machine code insertion. + * sem_ch13.adb (Analyze_Code_Statement) If CodePeer_Mode is True, + mark the N_Code_Statement node as analyzed and do nothing else. + 2015-11-12 Ed Schonberg * sem_ch6.adb (Check_Limited_Return): Make global to package diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 36eb7ad5490..f368957c4ae 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -6043,9 +6043,17 @@ package body Sem_Ch13 is DeclO : Node_Id; begin + -- Accept foreign code statements for CodePeer. The analysis is skipped + -- to avoid rejecting unrecognized constructs. + + if CodePeer_Mode then + Set_Analyzed (N); + return; + end if; + -- Analyze and check we get right type, note that this implements the - -- requirement (RM 13.8(1)) that Machine_Code be with'ed, since that - -- is the only way that Asm_Insn could possibly be visible. + -- requirement (RM 13.8(1)) that Machine_Code be with'ed, since that is + -- the only way that Asm_Insn could possibly be visible. Analyze_And_Resolve (Expression (N)); @@ -6058,8 +6066,8 @@ package body Sem_Ch13 is Check_Code_Statement (N); - -- Make sure we appear in the handled statement sequence of a - -- subprogram (RM 13.8(3)). + -- Make sure we appear in the handled statement sequence of a subprogram + -- (RM 13.8(3)). if Nkind (HSS) /= N_Handled_Sequence_Of_Statements or else Nkind (SBody) /= N_Subprogram_Body @@ -6112,7 +6120,7 @@ package body Sem_Ch13 is while Present (Stmt) loop StmtO := Original_Node (Stmt); - -- A procedure call transformed into a code statement is OK. + -- A procedure call transformed into a code statement is OK if Ada_Version >= Ada_2012 and then Nkind (StmtO) = N_Procedure_Call_Statement diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index ea5ca615841..91e41e259fa 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1559,11 +1559,17 @@ package body Sem_Ch6 is -- parameterless member of an entry family. Resolution of these various -- interpretations is delicate. - Analyze (P); + -- Do not analyze machine code statements to avoid rejecting them in + -- CodePeer mode. - -- If this is a call of the form Obj.Op, the call may have been - -- analyzed and possibly rewritten into a block, in which case - -- we are done. + if CodePeer_Mode and then Nkind (P) = N_Qualified_Expression then + Set_Etype (P, Standard_Void_Type); + else + Analyze (P); + end if; + + -- If this is a call of the form Obj.Op, the call may have been analyzed + -- and possibly rewritten into a block, in which case we are done. if Analyzed (N) then return; @@ -1632,8 +1638,8 @@ package body Sem_Ch6 is Analyze_Call_And_Resolve; - -- If the prefix is the simple name of an entry family, this is - -- a parameterless call from within the task body itself. + -- If the prefix is the simple name of an entry family, this is a + -- parameterless call from within the task body itself. elsif Is_Entity_Name (P) and then Nkind (P) = N_Identifier -- 2.30.2