summaryrefslogtreecommitdiff
path: root/gcc/ada/par_sco.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-06 10:20:41 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-06 10:20:41 +0000
commitf6aa36b95e2607c6fbeccb22230fc5dd9d8486d4 (patch)
tree44faecf9685467f3cfe0c70f98f98c4a7e9d1616 /gcc/ada/par_sco.adb
parent50a0a4ff35114569fdf745888f9a2df3e85073bf (diff)
downloadgcc-f6aa36b95e2607c6fbeccb22230fc5dd9d8486d4.tar.gz
2012-11-06 Robert Dewar <dewar@adacore.com>
* par_sco.adb, bindgen.adb, exp_vfpt.adb, exp_vfpt.ads, exp_ch2.adb, errout.adb, sem_ch8.adb: Minor reformatting. 2012-11-06 Hristian Kirtchev <kirtchev@adacore.com> * einfo.adb: Include Loop_Entry_Attributes to the list of Node/List/Elist10 usage. (Loop_Entry_Attributes): New routine. (Set_Loop_Entry_Attributes): New routine. (Write_Field10_Name): Add an output string for Loop_Entry_Attributes. * einfo.ads: Define new attribute Loop_Entry_Attributes along with its usage in nodes. (Loop_Entry_Attributes): New routine and dedicated pragma Inline. (Set_Loop_Entry_Attributes): New routine and dedicated pragma Inline. * exp_attr.adb (Expand_N_Attribute_Reference): Do not expand Attribute_Loop_Entry here. * exp_ch5.adb: Add with and use clause for Elists; (Expand_Loop_Entry_Attributes): New routine. (Expand_N_Loop_Statement): Add a call to Expand_Loop_Entry_Attributes. * exp_prag.adb (Expand_Pragma_Loop_Assertion): Specialize the search to include multiple nested loops produced by the expansion of Ada 2012 array iterator. * sem_attr.adb: Add with and use clause for Elists. (Analyze_Attribute): Check the legality of attribute Loop_Entry. (Resolve_Attribute): Nothing to do for Loop_Entry. (S14_Attribute): New routine. * snames.ads-tmpl: Add a comment on entries marked with HiLite. Add new name Name_Loop_Entry. Add new attribute Attribute_Loop_Entry. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193227 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par_sco.adb')
-rw-r--r--gcc/ada/par_sco.adb27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb
index be258bfb8b0..cec2afefdb2 100644
--- a/gcc/ada/par_sco.adb
+++ b/gcc/ada/par_sco.adb
@@ -34,6 +34,8 @@ with Opt; use Opt;
with Output; use Output;
with Put_SCOs;
with SCOs; use SCOs;
+with Sem; use Sem;
+with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
with Snames; use Snames;
@@ -926,9 +928,14 @@ package body Par_SCO is
Sloc_Range (Orig, Start, Dummy);
Index := Condition_Pragma_Hash_Table.Get (Start);
- -- The test here for zero is to deal with possible previous errors
+ -- Index can be zero for boolean expressions that do not have SCOs
+ -- (simple decisions outside of a control flow structure), or in case
+ -- of a previous error.
- if Index /= 0 then
+ if Index = 0 then
+ return;
+
+ else
pragma Assert (SCO_Table.Table (Index).C1 = ' ');
SCO_Table.Table (Index).C2 := Constant_Condition_Code (Val);
end if;
@@ -942,6 +949,17 @@ package body Par_SCO is
Index : Nat;
begin
+ -- Nothing to do if not generating SCO, or if we're not processing the
+ -- original source occurrence of the pragma.
+
+ if not (Generate_SCO
+ and then
+ In_Extended_Main_Source_Unit (Cunit_Entity (Current_Sem_Unit))
+ and then not (In_Instance or In_Inlined_Body))
+ then
+ return;
+ end if;
+
-- Note: the reason we use the Sloc value as the key is that in the
-- generic case, the call to this procedure is made on a copy of the
-- original node, so we can't use the Node_Id value.
@@ -950,7 +968,10 @@ package body Par_SCO is
-- The test here for zero is to deal with possible previous errors
- if Index /= 0 then
+ if Index = 0 then
+ Cascaded_Error;
+
+ else
declare
T : SCO_Table_Entry renames SCO_Table.Table (Index);