aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2014-07-17 06:31:56 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-17 08:31:56 +0200
commit59f4d03898e13da463a202919875dfa3fac43456 (patch)
tree84782b9ac1d2b0036fbe2feefa633ef942ef6fe3 /gcc/ada/checks.adb
parent26d5fb62eff87da5ee2ff5bf2f7129d2a842f8c6 (diff)
downloadgcc-59f4d03898e13da463a202919875dfa3fac43456.zip
gcc-59f4d03898e13da463a202919875dfa3fac43456.tar.gz
gcc-59f4d03898e13da463a202919875dfa3fac43456.tar.bz2
back_end.adb: Minor reformatting and comment additions.
2014-07-17 Robert Dewar <dewar@adacore.com> * back_end.adb: Minor reformatting and comment additions. * checks.ads, checks.adb (Duplicated_Tag_Checks_Suppressed): New function. * exp_disp.adb (Make_DT): Use Duplicated_Tag_Checks_Suppressed. (Make_VM_TSD): Use Duplicated_Tag_Checks_Suppressed. * gnat_rm.texi: Document new check Duplicated_Tag_Checks_Suppressed. * gnat_ugn.texi: Additional documentation for Duplicated_Tag_Check. * snames.ads-tmpl (Duplicated_Tag_Checks_Suppressed): New check. * types.ads (Duplicated_Tag_Checks_Suppressed): New check. From-SVN: r212724
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb35
1 files changed, 32 insertions, 3 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index ea1f164..81bbc67 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -423,6 +423,11 @@ package body Checks is
-- Allocation_Checks_Suppressed --
----------------------------------
+ -- Note: at the current time there are no calls to this function, because
+ -- the relevant check is in the run-time, so it is not a check that the
+ -- compiler can suppress anyway, but we still have to recognize the check
+ -- name Allocation_Check since it is part of the standard.
+
function Allocation_Checks_Suppressed (E : Entity_Id) return Boolean is
begin
if Present (E) and then Checks_May_Be_Suppressed (E) then
@@ -4616,6 +4621,19 @@ package body Checks is
end if;
end Division_Checks_Suppressed;
+ --------------------------------------
+ -- Duplicated_Tag_Checks_Suppressed --
+ --------------------------------------
+
+ function Duplicated_Tag_Checks_Suppressed (E : Entity_Id) return Boolean is
+ begin
+ if Present (E) and then Checks_May_Be_Suppressed (E) then
+ return Is_Check_Suppressed (E, Duplicated_Tag_Check);
+ else
+ return Scope_Suppress.Suppress (Duplicated_Tag_Check);
+ end if;
+ end Duplicated_Tag_Checks_Suppressed;
+
-----------------------------------
-- Elaboration_Checks_Suppressed --
-----------------------------------
@@ -6478,15 +6496,24 @@ package body Checks is
-- Force evaluation to avoid multiple reads for atomic/volatile
+ -- Note: we set Name_Req to False. We used to set it to True, with
+ -- the thinking that a name is required as the prefix of the 'Valid
+ -- call, but in fact the check that the prefix of an attribute is
+ -- a name is in the parser, and we just don't require it here.
+ -- Moreover, when we set Name_Req to True, that interfered with the
+ -- checking for Volatile, since we couldn't just capture the value.
+
if Is_Entity_Name (Exp)
and then Is_Volatile (Entity (Exp))
then
- Force_Evaluation (Exp, Name_Req => True);
+ -- Same reasoning as above for setting Name_Req to False
+
+ Force_Evaluation (Exp, Name_Req => False);
end if;
-- Build the prefix for the 'Valid call
- PV := Duplicate_Subexpr_No_Checks (Exp, Name_Req => True);
+ PV := Duplicate_Subexpr_No_Checks (Exp, Name_Req => False);
-- A rather specialized kludge. If PV is an analyzed expression
-- which is an indexed component of a packed array that has not
@@ -6504,7 +6531,9 @@ package body Checks is
Set_Analyzed (PV, False);
end if;
- -- Build the raise CE node to check for validity
+ -- Build the raise CE node to check for validity. We build a type
+ -- qualification for the prefix, since it may not be of the form of
+ -- a name, and we don't care in this context!
CE :=
Make_Raise_Constraint_Error (Loc,