diff options
-rw-r--r-- | gcc/ada/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 26 | ||||
-rw-r--r-- | gcc/ada/usage.adb | 2 | ||||
-rw-r--r-- | gcc/ada/xsnamest.adb | 10 |
4 files changed, 42 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f3315d7..3e021e9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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. diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 75e98c0..96a295c 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -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; diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb index 6d70440..541496c 100644 --- a/gcc/ada/usage.adb +++ b/gcc/ada/usage.adb @@ -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 " & diff --git a/gcc/ada/xsnamest.adb b/gcc/ada/xsnamest.adb index c4c386b..7dd3ca2 100644 --- a/gcc/ada/xsnamest.adb +++ b/gcc/ada/xsnamest.adb @@ -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- -- @@ -24,10 +24,10 @@ ------------------------------------------------------------------------------ -- 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; |