aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-03-04 10:58:41 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-03-04 10:58:41 +0100
commit26f36fc9f65e8bcc265d62996d65616e437fb3fa (patch)
treee6cb9198d215ba3759d978fc937960b14a98fb47 /gcc/ada/sem_attr.adb
parent488f9623ba0c3762eec2fdd9117c0d8dccb4d797 (diff)
downloadgcc-26f36fc9f65e8bcc265d62996d65616e437fb3fa.zip
gcc-26f36fc9f65e8bcc265d62996d65616e437fb3fa.tar.gz
gcc-26f36fc9f65e8bcc265d62996d65616e437fb3fa.tar.bz2
[multiple changes]
2015-03-04 Ed Schonberg <schonberg@adacore.com> * sem_warn.adb (Check_References): When checking for an unused in-out parameter of a class- wide type, use its type to determine whether it is private, in order to avoid a spurious warning when subprogram spec and body are in different units. 2015-03-04 Yannick Moy <moy@adacore.com> * sem_attr.adb: Improve warning messages. From-SVN: r221178
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb40
1 files changed, 26 insertions, 14 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 21040ab..01b0cd8 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1103,6 +1103,10 @@ package body Sem_Attr is
-- Subsidiary to Check_Placemenet_In_XXX. Determine whether arbitrary
-- node Nod is within enclosing node Encl_Nod.
+ procedure Placement_Error;
+ -- Emit a general error when the attributes does not appear in a
+ -- postcondition-like aspect or pragma.
+
------------------------------
-- Check_Placement_In_Check --
------------------------------
@@ -1124,17 +1128,7 @@ package body Sem_Attr is
-- Otherwise the placement of the attribute is illegal
else
- if Aname = Name_Old then
- Error_Attr
- ("attribute % can only appear in postcondition", P);
-
- -- Specialize the error message for attribute 'Result
-
- else
- Error_Attr
- ("attribute % can only appear in postcondition of "
- & "function", P);
- end if;
+ Placement_Error;
end if;
end Check_Placement_In_Check;
@@ -1236,6 +1230,24 @@ package body Sem_Attr is
return False;
end Is_Within;
+ ---------------------
+ -- Placement_Error --
+ ---------------------
+
+ procedure Placement_Error is
+ begin
+ if Aname = Name_Old then
+ Error_Attr ("attribute % can only appear in postcondition", P);
+
+ -- Specialize the error message for attribute 'Result
+
+ else
+ Error_Attr
+ ("attribute % can only appear in postcondition of function",
+ P);
+ end if;
+ end Placement_Error;
+
-- Local variables
Prag : Node_Id;
@@ -1294,14 +1306,14 @@ package body Sem_Attr is
Check_Placement_In_Test_Case (Prag);
else
- Error_Attr ("attribute % can only appear in postcondition", P);
+ Placement_Error;
return;
end if;
-- Otherwise the placement of the attribute is illegal
else
- Error_Attr ("attribute % can only appear in postcondition", P);
+ Placement_Error;
return;
end if;
@@ -4797,7 +4809,7 @@ package body Sem_Attr is
if Is_Constant_Object (Pref_Id) then
Error_Msg_Name_1 := Name_Old;
Error_Msg_N
- ("??atribute % applied to constant has no effect", P);
+ ("??attribute % applied to constant has no effect", P);
end if;
-- Otherwise the prefix is not a simple name