This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] warning patrol
- To: guerby at acm dot org
- Subject: Re: [Ada] warning patrol
- From: Geert Bosch <bosch at gnat dot com>
- Date: Sat, 27 Oct 2001 18:44:06 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org
Hi Laurent,
I'm sorry to say that I've already been working on this issue and have
a set of changes for this. Even though your changes are correct in
that they get rid of the warnings, I have some comments on them as I noted
below. Thanks anyway for your patch.
-Geert
On Sun, 28 Oct 2001 guerby@acm.org wrote:
* ali-util.adb (Initialize_Checksum): Change parameter mode to silence warning.
I already have a patch for this one, doing the same thing. (Checked in
ACT tree, waiting to be checked in GCC tree when I'm back at work.)
* checks.adb (Determine_Range): Provide initialization to silence warning.
I am not at all convinced that there is not a real bug underlying the
uninitialized variable here. In any case, the logic isn't clean enough
and in particular the local variables needs comments explaining their
function. Friday I generated an ACT bug report for this and it will
be fixed soon.
* layout.adb (Get_Max_Size, Layout_Array_Type): Likewise.
For this warning, I am testing a better change using a variant record,
which documents better for the reader of the code that indeed the variable
is not used.
* tracebak.c (__gnat_backtrace): Remove unused variable.
I'll commit this obvious change.
BTW, do you have a copyright assignment on file with FSF?
-Geert
Index: ali-util.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/ali-util.adb,v
retrieving revision 1.2
diff -c -3 -p -r1.2 ali-util.adb
*** ali-util.adb 2001/10/11 23:28:47 1.2
--- ali-util.adb 2001/10/27 21:57:47
*************** package body ALI.Util is
*** 50,56 ****
-- generate code, so it is not necessary to worry about making the right
-- sequence of calls in any error situation.
! procedure Initialize_Checksum (Csum : in out Word);
-- Sets initial value of Csum before any calls to Accumulate_Checksum
-------------------------
--- 50,56 ----
-- generate code, so it is not necessary to worry about making the right
-- sequence of calls in any error situation.
! procedure Initialize_Checksum (Csum : out Word);
-- Sets initial value of Csum before any calls to Accumulate_Checksum
-------------------------
*************** package body ALI.Util is
*** 286,292 ****
-- Initialize_Checksum --
-------------------------
! procedure Initialize_Checksum (Csum : in out Word) is
begin
System.CRC32.Initialize (System.CRC32.CRC32 (Csum));
end Initialize_Checksum;
--- 286,292 ----
-- Initialize_Checksum --
-------------------------
! procedure Initialize_Checksum (Csum : out Word) is
begin
System.CRC32.Initialize (System.CRC32.CRC32 (Csum));
end Initialize_Checksum;
Index: checks.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/checks.adb,v
retrieving revision 1.2
diff -c -3 -p -r1.2 checks.adb
*** checks.adb 2001/10/10 22:46:39 1.2
--- checks.adb 2001/10/27 21:57:55
*************** package body Checks is
*** 1891,1897 ****
Hi_Left : Uint;
Hi_Right : Uint;
Bound : Node_Id;
! Hbound : Uint;
Lor : Uint;
Hir : Uint;
OK1 : Boolean;
--- 1891,1897 ----
Hi_Left : Uint;
Hi_Right : Uint;
Bound : Node_Id;
! Hbound : Uint := No_Uint;
Lor : Uint;
Hir : Uint;
OK1 : Boolean;
Index: layout.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/layout.adb,v
retrieving revision 1.1
diff -c -3 -p -r1.1 layout.adb
*** layout.adb 2001/10/02 14:18:39 1.1
--- layout.adb 2001/10/27 21:58:01
*************** package body Layout is
*** 591,597 ****
-- Calculated value so far if Val_Status = Const
-- (initialized to prevent junk warning)
! Snod : Node_Id;
-- Expression value so far if Val_Status = Dynamic
SU_Convert_Required : Boolean := False;
--- 591,597 ----
-- Calculated value so far if Val_Status = Const
-- (initialized to prevent junk warning)
! Snod : Node_Id := Empty;
-- Expression value so far if Val_Status = Dynamic
SU_Convert_Required : Boolean := False;
*************** package body Layout is
*** 852,858 ****
-- Calculated value so far if Val_Status = Const
-- Initialized to prevent junk warning
! Snod : Node_Id;
-- Expression value so far if Val_Status /= Const
Vtyp : Entity_Id;
--- 852,858 ----
-- Calculated value so far if Val_Status = Const
-- Initialized to prevent junk warning
! Snod : Node_Id := Empty;
-- Expression value so far if Val_Status /= Const
Vtyp : Entity_Id;
Index: tracebak.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/tracebak.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 tracebak.c
*** tracebak.c 2001/10/04 17:50:42 1.2
--- tracebak.c 2001/10/27 21:58:04
*************** __gnat_backtrace (array, size, exclude_m
*** 202,208 ****
struct layout *current;
void *top_frame;
void *top_stack;
- void *ret;
int cnt = 0;
#ifdef PROTECT_SEGV
--- 202,207 ----