2009-10-30 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Oct 2009 12:02:11 +0000 (12:02 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Oct 2009 12:02:11 +0000 (12:02 +0000)
* sem_res.adb (Resolve_Type_Conversion): Avoid false positive when
converting non-static subtype to "identical" static subtype.

2009-10-30  Ed Schonberg  <schonberg@adacore.com>

* usage.adb: Add -gnatw.i switch.

2009-10-30  Vincent Celier  <celier@adacore.com>

* xsnamest.adb: Update comments with regards to the template files
snames.*.tmpl

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153741 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/sem_res.adb
gcc/ada/usage.adb
gcc/ada/xsnamest.adb

index f3315d7..3e021e9 100644 (file)
@@ -1,3 +1,17 @@
+2009-10-30  Robert Dewar  <dewar@adacore.com>
+
+       * sem_res.adb (Resolve_Type_Conversion): Avoid false positive when
+       converting non-static subtype to "identical" static subtype.
+
+2009-10-30  Ed Schonberg  <schonberg@adacore.com>
+
+       * usage.adb: Add -gnatw.i switch.
+
+2009-10-30  Vincent Celier  <celier@adacore.com>
+
+       * xsnamest.adb: Update comments with regards to the template files
+       snames.*.tmpl
+
 2009-10-30  Bob Duff  <duff@adacore.com>
 
        * s-fileio.adb (Errno_Message): Suppress VMS-specific warning.
index 75e98c0..96a295c 100644 (file)
@@ -8254,8 +8254,8 @@ package body Sem_Res is
    -----------------------------
 
    procedure Resolve_Type_Conversion (N : Node_Id; Typ : Entity_Id) is
-      Conv_OK     : constant Boolean := Conversion_OK (N);
-      Operand     : constant Node_Id := Expression (N);
+      Conv_OK     : constant Boolean   := Conversion_OK (N);
+      Operand     : constant Node_Id   := Expression (N);
       Operand_Typ : constant Entity_Id := Etype (Operand);
       Target_Typ  : constant Entity_Id := Etype (N);
       Rop         : Node_Id;
@@ -8400,9 +8400,25 @@ package body Sem_Res is
                   (Ekind (Entity (Orig_N)) = E_Loop_Parameter
                      and then Covers (Orig_T, Etype (Entity (Orig_N)))))
          then
-            Error_Msg_Node_2 := Orig_T;
-            Error_Msg_NE -- CODEFIX
-              ("?redundant conversion, & is of type &!", N, Entity (Orig_N));
+            --  One more check, do not give warning if the analyzed conversion
+            --  has an expression with non-static bounds, and the bounds of the
+            --  target are static. This avoids junk warnings in cases where the
+            --  conversion is necessary to establish staticness, for example in
+            --  a case statement.
+
+            if not Is_OK_Static_Subtype (Operand_Typ)
+              and then Is_OK_Static_Subtype (Target_Typ)
+            then
+               null;
+
+            --  Here we give the redundant conversion warning
+
+            else
+               Error_Msg_Node_2 := Orig_T;
+               Error_Msg_NE -- CODEFIX
+                 ("?redundant conversion, & is of type &!",
+                  N, Entity (Orig_N));
+            end if;
          end if;
       end if;
 
index 6d70440..541496c 100644 (file)
@@ -424,6 +424,8 @@ begin
    Write_Line ("        H*   turn off warnings for hiding variable");
    Write_Line ("        i*   turn on warnings for implementation unit");
    Write_Line ("        I    turn off warnings for implementation unit");
+   Write_Line ("        .i   turn on warnings for overlapping actuals");
+   Write_Line ("        .I*  turn off warnings for overlapping actuals");
    Write_Line ("        j    turn on warnings for obsolescent " &
                                                   "(annex J) feature");
    Write_Line ("        J*   turn off warnings for obsolescent " &
index c4c386b..7dd3ca2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2008, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2009, 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- --
 ------------------------------------------------------------------------------
 
 --  This utility is used to make a new version of the Snames package when new
---  names are added. This version reads a template file from snames.adt in
---  which the numbers are all written as $, and generates a new version of
---  the spec file snames.ads (written to snames.ns). It also reads snames.adb
---  and generates an updated body (written to snames.nb), and snames.h and
+--  names are added. This version reads a template file from snames.ads-tmpl in
+--  which the numbers are all written as $, and generates a new version of the
+--  spec file snames.ads (written to snames.ns). It also reads snames.adb-tmpl
+--  and generates an updated body (written to snames.nb), and snames.h-tmpl and
 --  generates an updated C header file (written to snames.nh).
 
 with Ada.Strings.Unbounded;         use Ada.Strings.Unbounded;