diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 17:58:16 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 17:58:16 +0000 |
commit | c0d40c9a5eabd7eb4034ac7b92053cb2a2cedae4 (patch) | |
tree | 822b27575fa161de1d3401c4f2b7073cea546bbb /gcc/ada/freeze.adb | |
parent | 482e710391b4731de95c6a05e962eb4fef1146bd (diff) | |
download | gcc-c0d40c9a5eabd7eb4034ac7b92053cb2a2cedae4.tar.gz |
2006-10-31 Robert Dewar <dewar@adacore.com>
Ed Schonberg <schonberg@adacore.com>
* freeze.adb: Add handling of Last_Assignment field
(Warn_Overlay): Supply missing continuation marks in error msgs
(Freeze_Entity): Add check for Preelaborable_Initialization
* g-comlin.adb: Add Warnings (Off) to prevent new warning
* g-expect.adb: Add Warnings (Off) to prevent new warning
* lib-xref.adb: Add handling of Last_Assignment field
(Generate_Reference): Centralize handling of pragma Obsolescent here
(Generate_Reference): Accept an implicit reference generated for a
default in an instance.
(Generate_Reference): Accept a reference for a node that is not in the
main unit, if it is the generic body corresponding to an subprogram
instantiation.
* xref_lib.adb: Add pragma Warnings (Off) to avoid new warnings
* sem_warn.ads, sem_warn.adb (Set_Warning_Switch): Add processing for
-gnatwq/Q.
(Warn_On_Useless_Assignment): Suppress warning if enclosing inner
exception handler.
(Output_Obsolescent_Entity_Warnings): Rewrite to avoid any messages on
use clauses, to avoid messages on packages used to qualify, and also
to avoid messages from obsolescent units.
(Warn_On_Useless_Assignments): Don't generate messages for imported
and exported variables.
(Warn_On_Useless_Assignments): New procedure
(Output_Obsolescent_Entity_Warnings): New procedure
(Check_Code_Statement): New procedure
* einfo.ads, einfo.adb (Has_Static_Discriminants): New flag
Change name Is_Ada_2005 to Is_Ada_2005_Only
(Last_Assignment): New field for useless assignment warning
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118271 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index da997c0dac6..5406f07cb61 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -887,31 +887,12 @@ package body Freeze is (T : Entity_Id) return Boolean is Constraint : Elmt_Id; - Discr : Entity_Id; begin if Has_Discriminants (T) and then Present (Discriminant_Constraint (T)) and then Present (First_Component (T)) then - Discr := First_Discriminant (T); - - if Is_Access_Type (Etype (Discr)) then - null; - - -- If the bounds of the discriminant are not compile-time known, - -- treat this as non-static, even if the value of the discriminant - -- is compile-time known, because the back-end treats aggregates - -- of such a subtype as having unknown size. - - elsif not - (Compile_Time_Known_Value (Type_Low_Bound (Etype (Discr))) - and then - Compile_Time_Known_Value (Type_High_Bound (Etype (Discr)))) - then - return False; - end if; - Constraint := First_Elmt (Discriminant_Constraint (T)); while Present (Constraint) loop if not Compile_Time_Known_Value (Node (Constraint)) then @@ -2453,6 +2434,16 @@ package body Freeze is -- Case of a type or subtype being frozen else + -- Check preelaborable initialization for full type completing a + -- private type for which pragma Preelaborable_Initialization given. + + if Must_Have_Preelab_Init (E) + and then not Has_Preelaborable_Initialization (E) + then + Error_Msg_N + ("full view of & does not have preelaborable initialization", E); + end if; + -- The type may be defined in a generic unit. This can occur when -- freezing a generic function that returns the type (which is -- defined in a parent unit). It is clearly meaningless to freeze @@ -3014,7 +3005,7 @@ package body Freeze is Freeze_Subprogram (E); - -- AI-326: Check wrong use of tag incomplete type + -- Ada 2005 (AI-326): Check wrong use of tag incomplete type -- -- type T is tagged; -- type Acc is access function (X : T) return T; -- ERROR @@ -4503,11 +4494,15 @@ package body Freeze is -- Reset True_Constant flag, since something strange is going on with -- the scoping here, and our simple value tracing may not be sufficient -- for this indication to be reliable. We kill the Constant_Value - -- indication for the same reason. + -- and Last_Assignment indications for the same reason. Set_Is_True_Constant (E, False); Set_Current_Value (E, Empty); + if Ekind (E) = E_Variable then + Set_Last_Assignment (E, Empty); + end if; + exception when Cannot_Be_Static => @@ -5091,8 +5086,9 @@ package body Freeze is and then Present (Packed_Array_Type (Etype (Comp))) then Error_Msg_NE - ("packed array component& will be initialized to zero?", - Nam, Comp); + ("\packed array component& " & + "will be initialized to zero?", + Nam, Comp); exit; else Next_Component (Comp); @@ -5102,9 +5098,9 @@ package body Freeze is end if; Error_Msg_N - ("use pragma Import for & to " & - "suppress initialization ('R'M B.1(24))?", - Nam); + ("\use pragma Import for & to " & + "suppress initialization ('R'M B.1(24))?", + Nam); end if; end Warn_Overlay; |