aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2014-02-06 14:09:36 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2014-02-06 15:09:36 +0100
commit428684fd1c052848969dba78f1e09a91fdd7f466 (patch)
tree4529dfaa3caa730e3a30b99fb46d2380889a1300 /gcc/ada/sem_util.adb
parent8c35b40a37767f63bdad36db3bb1c16f3c5f7c6b (diff)
downloadgcc-428684fd1c052848969dba78f1e09a91fdd7f466.zip
gcc-428684fd1c052848969dba78f1e09a91fdd7f466.tar.gz
gcc-428684fd1c052848969dba78f1e09a91fdd7f466.tar.bz2
sem_attr.adb (Analyze_Attribute, case Max): Check for improper comparison of unordered enumeration type.
2014-02-06 Robert Dewar <dewar@adacore.com> * sem_attr.adb (Analyze_Attribute, case Max): Check for improper comparison of unordered enumeration type. (Analyze_Attribute, case Max): Check for improper comparison of unordered enumeration type. * sem_res.adb (Bad_Unordered_Enumeration_Reference): Moved to sem_util.adb. * sem_util.ads, sem_util.adb (Bad_Unordered_Enumeration_Reference): Moved here from Sem_Res. From-SVN: r207556
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index a2501ca..2e79e11 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -669,6 +669,22 @@ package body Sem_Util is
end if;
end Bad_Predicated_Subtype_Use;
+ ----------------------------------------
+ -- Bad_Unordered_Enumeration_Reference --
+ ----------------------------------------
+
+ function Bad_Unordered_Enumeration_Reference
+ (N : Node_Id;
+ T : Entity_Id) return Boolean
+ is
+ begin
+ return Is_Enumeration_Type (T)
+ and then Comes_From_Source (N)
+ and then Warn_On_Unordered_Enumeration_Type
+ and then not Has_Pragma_Ordered (T)
+ and then not In_Same_Extended_Unit (N, T);
+ end Bad_Unordered_Enumeration_Reference;
+
--------------------------
-- Build_Actual_Subtype --
--------------------------