diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-22 12:41:17 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-22 12:41:17 +0200 |
commit | 26df19ce4f23305c36afaa49cce1aa88a7199eda (patch) | |
tree | bdf76ce8ebb9ad9bd050ccab4a7ee4c1aa3a57c6 /gcc/ada/sem_attr.adb | |
parent | 0937fb69fec34dfefa6c9bc790c41c756a580720 (diff) | |
download | gcc-26df19ce4f23305c36afaa49cce1aa88a7199eda.zip gcc-26df19ce4f23305c36afaa49cce1aa88a7199eda.tar.gz gcc-26df19ce4f23305c36afaa49cce1aa88a7199eda.tar.bz2 |
[multiple changes]
2010-10-22 Robert Dewar <dewar@adacore.com>
* par-ch5.adb: Minor reformatting.
* gcc-interface/Make-lang.in: Update dependencies.
2010-10-22 Robert Dewar <dewar@adacore.com>
* a-except.adb, a-except-2005.adb: Add new Rcheck entry.
* exp_ch13.adb (Add_Call): Make sure subtype is marked with
Has_Predicates set to True if it inherits predicates.
* sem_attr.adb: Handle 'First/'Last/'Range for predicated types
* types.ads (PE_Bad_Attribute_For_Predicate): New reason code
* types.h: Add new Rcheck entry.
* einfo.ads, einfo.adb (Static_Predicate): New field.
Minor code reorganization (file float routines in proper section)
Fix bad field name in comments.
2010-10-22 Robert Dewar <dewar@adacore.com>
* sem_eval.adb (Subtypes_Statically_Compatible): Check null exclusion
case.
2010-10-22 Vincent Celier <celier@adacore.com>
* prj-conf.adb (Get_Config_Switches): Detect if there is at least one
declaration of IDE'Compiler_Command for one of the language in the main
project.
(Do_Autoconf): If there were at least one Compiler_Command declared and
no target, invoke gprconfig with --target=all instead of the normalized
host name.
2010-10-22 Robert Dewar <dewar@adacore.com>
* par-ch4.adb: Update syntax in comments for Ada 2012.
* sinfo.ads: Update syntax in comments for Ada 2012
* par-ch3.adb (Check_Restricted_Expression): Remove "in Ada 2012 mode"
from msg.
From-SVN: r165822
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 819de42..0867975 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -211,6 +211,12 @@ package body Sem_Attr is -- Used for Access, Unchecked_Access, Unrestricted_Access attributes. -- Internally, Id distinguishes which of the three cases is involved. + procedure Bad_Attribute_For_Predicate; + -- Output error message for use of a predicate (First, Last, Range) not + -- allowed with a type that has predicates. If the type is a generic + -- actual, then the message is a warning, and we generate code to raise + -- program error with an appropriate reason. + procedure Check_Array_Or_Scalar_Type; -- Common procedure used by First, Last, Range attribute to check -- that the prefix is a constrained array or scalar type, or a name @@ -826,6 +832,32 @@ package body Sem_Attr is end if; end Analyze_Access_Attribute; + --------------------------------- + -- Bad_Attribute_For_Predicate -- + --------------------------------- + + procedure Bad_Attribute_For_Predicate is + begin + if Has_Predicates (P_Type) then + Error_Msg_Name_1 := Aname; + + if Is_Generic_Actual_Type (P_Type) then + Error_Msg_F + ("type& has predicates, attribute % not allowed?", P); + Error_Msg_F + ("\?Program_Error will be raised at run time", P); + Rewrite (N, + Make_Raise_Program_Error (Loc, + Reason => PE_Bad_Attribute_For_Predicate)); + + else + Error_Msg_F + ("type& has predicates, attribute % not allowed", P); + Error_Attr; + end if; + end if; + end Bad_Attribute_For_Predicate; + -------------------------------- -- Check_Array_Or_Scalar_Type -- -------------------------------- @@ -3078,6 +3110,7 @@ package body Sem_Attr is when Attribute_First => Check_Array_Or_Scalar_Type; + Bad_Attribute_For_Predicate; --------------- -- First_Bit -- @@ -3292,6 +3325,7 @@ package body Sem_Attr is when Attribute_Last => Check_Array_Or_Scalar_Type; + Bad_Attribute_For_Predicate; -------------- -- Last_Bit -- @@ -3645,6 +3679,7 @@ package body Sem_Attr is --------- when Attribute_Old => + -- The attribute reference is a primary. If expressions follow, the -- attribute reference is an indexable object, so rewrite the node -- accordingly. @@ -3895,6 +3930,7 @@ package body Sem_Attr is when Attribute_Range => Check_Array_Or_Scalar_Type; + Bad_Attribute_For_Predicate; if Ada_Version = Ada_83 and then Is_Scalar_Type (P_Type) |