OSDN Git Service

2007-04-20 Vincent Celier <celier@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_warn.ads
index 1482ff8..86c36a9 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                            $Revision$
---                                                                          --
---          Copyright (C) 1999-2001 Free Software Foundation, Inc.          --
+--          Copyright (C) 1999-2007, 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- --
 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
 -- for  more details.  You should have  received  a copy of the GNU General --
 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
--- MA 02111-1307, USA.                                                      --
+-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
+-- Boston, MA 02110-1301, USA.                                              --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -34,6 +32,22 @@ with Types; use Types;
 
 package Sem_Warn is
 
+   --------------------
+   -- Initialization --
+   --------------------
+
+   function Set_Warning_Switch (C : Character) return Boolean;
+   --  This function sets the warning switch or switches corresponding to the
+   --  given character. It is used to process a -gnatw switch on the command
+   --  line, or a character in a string literal in pragma Warnings. Returns
+   --  True for valid warning character C, False for invalid character.
+
+   function Set_Dot_Warning_Switch (C : Character) return Boolean;
+   --  This function sets the warning switch or switches corresponding to the
+   --  given character preceded by a dot. Used to process a -gnatw. switch on
+   --  the command line or .C in a string literal in pragma Warnings. Returns
+   --  True for valid warning character C, False for invalid character.
+
    ------------------------------------------
    -- Routines to Handle Unused References --
    ------------------------------------------
@@ -91,6 +105,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
@@ -100,6 +119,13 @@ package Sem_Warn is
    -- Other Warning Routines --
    ----------------------------
 
+   procedure Check_Code_Statement (N : Node_Id);
+   --  Perform warning checks on a code statement node
+
+   procedure Check_Infinite_Loop_Warning (Loop_Statement : Node_Id);
+   --  N is the node for a loop statement. This procedure checks if a warning
+   --  should be given for a possible infinite loop, and if so issues it.
+
    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
@@ -125,4 +151,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;