summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_warn.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 17:58:16 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 17:58:16 +0000
commitc0d40c9a5eabd7eb4034ac7b92053cb2a2cedae4 (patch)
tree822b27575fa161de1d3401c4f2b7073cea546bbb /gcc/ada/sem_warn.ads
parent482e710391b4731de95c6a05e962eb4fef1146bd (diff)
downloadgcc-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/sem_warn.ads')
-rw-r--r--gcc/ada/sem_warn.ads35
1 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads
index be2fd6f11af..25dafaa71e7 100644
--- a/gcc/ada/sem_warn.ads
+++ b/gcc/ada/sem_warn.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -98,6 +98,11 @@ package Sem_Warn is
-- Output Routines --
---------------------
+ procedure Output_Obsolescent_Entity_Warnings (N : Node_Id; E : Entity_Id);
+ -- N is a reference to obsolescent entity E, for which appropriate warning
+ -- messages are to be generated (caller has already checked that warnings
+ -- are active and appropriate for this entity).
+
procedure Output_Unreferenced_Messages;
-- Warnings about unreferenced entities are collected till the end of
-- the compilation process (see Check_Unset_Reference for further
@@ -107,6 +112,9 @@ package Sem_Warn is
-- Other Warning Routines --
----------------------------
+ procedure Check_Code_Statement (N : Node_Id);
+ -- Peform warning checks on a code statement node
+
procedure Warn_On_Known_Condition (C : Node_Id);
-- C is a node for a boolean expression resluting from a relational
-- or membership operation. If the expression has a compile time known
@@ -132,4 +140,29 @@ package Sem_Warn is
-- If all these conditions are met, the warning is issued noting that
-- the result of the test is always false or always true as appropriate.
+ procedure Warn_On_Suspicious_Index (Name : Entity_Id; X : Node_Id);
+ -- This is called after resolving an indexed component or a slice. Name
+ -- is the entity for the name of the indexed array, and X is the subscript
+ -- for the indexed component case, or one of the bounds in the slice case.
+ -- If Name is an unconstrained parameter of a standard string type, and
+ -- the index is of the form of a literal or Name'Length [- literal], then
+ -- a warning is generated that the subscripting operation is possibly
+ -- incorrectly assuming a lower bound of 1.
+
+ procedure Warn_On_Useless_Assignment
+ (Ent : Entity_Id;
+ Loc : Source_Ptr := No_Location);
+ -- Called to check if we have a case of a useless assignment to the given
+ -- entity Ent, as indicated by a non-empty Last_Assignment field. This call
+ -- should only be made if Warn_On_Modified_Unread is True, and if Ent is in
+ -- the extended main source unit. Loc is No_Location for the end of block
+ -- call (warning msg says value unreferenced), or the it is the location of
+ -- an overwriting assignment (warning msg points to this assignment).
+
+ procedure Warn_On_Useless_Assignments (E : Entity_Id);
+ pragma Inline (Warn_On_Useless_Assignments);
+ -- Called at the end of a block or subprogram. Scans the entities of the
+ -- block or subprogram to see if there are any variables for which useless
+ -- assignments were made (assignments whose values were never read).
+
end Sem_Warn;