This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] Warning patrol part 1


Hi,

This patch, together with the 3 messages that immediately follow it 
removes more warnings from the bootstrap on the mainline.  Bootstrapped and 
tested without regressions on i686-pc-linux-gnu.  Testing was done in one 
go: this patch, the patches following it and these pending ones, which also 
remove warnings, and eliminate some dead code.

http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01532.html
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01530.html
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01528.html
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01425.html
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01424.html
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01422.html
by Matt Kraai:
http://gcc.gnu.org/ml/gcc-patches/2001-03/msg01217.html

This removes a total of 51 (of the current 120) warnings of a stage3 
bootstrap.  I send them in separately since I think this might help the 
review proces.  If one merged patch is preferred, please just ask.  
Likewise if more (or less) explanation is wanted.

Some recent changes to bitmap.c and bitmap.h triggered these warnings while 
bootstrapping:

../../gcc/gcc/bitmap.c:41:16: warning: function-like macro "bitmap_zero" must be used with arguments in traditional C
../../gcc/gcc/bitmap.c:461:24: warning: function-like macro "bitmap_zero" must be used with arguments in traditional C
../../gcc/gcc/bitmap.c:468:24: warning: function-like macro "bitmap_zero" must be used with arguments in traditional C
../../gcc/gcc/bitmap.c: In function `bitmap_last_set_bit':
../../gcc/gcc/bitmap.c:709: warning: `i' might be used uninitialized in this function

They are eliminated with this patch

The patch which triggered these is here:
http://gcc.gnu.org/ml/gcc-patches/2001-04/msg01159.html
It was applied here:
2001-06-16  Daniel Berlin  <dan@cgsoftware.com>

The first three warnings are caused by this addition:

#define bitmap_zero(a) bitmap_clear (a)

which resulted in a name conflict, since bitmap_zero was already defined 
as:

bitmap_element bitmap_zero;		/* An element of all zero bits. */

The fourth warning is another false positive, with trivial work-around.

Please apply this if ok.

jan

Changelog:
2001-06-28  Jan van Male  <jan.vanmale@fenk.wau.nl>
        * bitmap.c: Rename bitmap_zero to bitmap_zero_bits to fix warnings.
        (bitmap_last_set_bit): Fix warning.
        * bitmap.h: Rename bitmap_zero to bitmap_zero_bits to fix warnings.


Index: gcc/gcc/bitmap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bitmap.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 bitmap.c
*** bitmap.c	2001/06/25 18:32:24	1.26
--- bitmap.c	2001/06/28 14:13:15
*************** static int bitmap_obstack_init = FALSE;
*** 38,44 ****
  #endif
  
  /* Global data */
! bitmap_element bitmap_zero;		/* An element of all zero bits. */
  bitmap_element *bitmap_free;		/* Freelist of bitmap elements. */
  
  static void bitmap_element_free		PARAMS ((bitmap, bitmap_element *));
--- 38,44 ----
  #endif
  
  /* Global data */
! bitmap_element bitmap_zero_bits;	/* An element of all zero bits. */
  bitmap_element *bitmap_free;		/* Freelist of bitmap elements. */
  
  static void bitmap_element_free		PARAMS ((bitmap, bitmap_element *));
*************** bitmap_operation (to, from1, from2, oper
*** 458,471 ****
  	{
  	  indx = indx1;
  	  from1_tmp = from1_ptr;
! 	  from2_tmp = &bitmap_zero;
  	  from1_ptr = from1_ptr->next;
  	  indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
  	}
        else
  	{
  	  indx = indx2;
! 	  from1_tmp = &bitmap_zero;
  	  from2_tmp = from2_ptr;
  	  from2_ptr = from2_ptr->next;
  	  indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
--- 458,471 ----
  	{
  	  indx = indx1;
  	  from1_tmp = from1_ptr;
! 	  from2_tmp = &bitmap_zero_bits;
  	  from1_ptr = from1_ptr->next;
  	  indx1 = (from1_ptr) ? from1_ptr->indx : HIGHEST_INDEX;
  	}
        else
  	{
  	  indx = indx2;
! 	  from1_tmp = &bitmap_zero_bits;
  	  from2_tmp = from2_ptr;
  	  from2_ptr = from2_ptr->next;
  	  indx2 = (from2_ptr) ? from2_ptr->indx : HIGHEST_INDEX;
*************** int 
*** 706,712 ****
  bitmap_last_set_bit (a)
       bitmap a;
  {
!   int i;
    EXECUTE_IF_SET_IN_BITMAP (a, 0, i, ;);
    if (bitmap_bit_p (a, i))
      return i;
--- 706,712 ----
  bitmap_last_set_bit (a)
       bitmap a;
  {
!   int i = 0;
    EXECUTE_IF_SET_IN_BITMAP (a, 0, i, ;);
    if (bitmap_bit_p (a, i))
      return i;
Index: gcc/gcc/bitmap.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bitmap.h,v
retrieving revision 1.20
diff -c -3 -p -r1.20 bitmap.h
*** bitmap.h	2001/06/16 16:13:23	1.20
--- bitmap.h	2001/06/28 14:13:16
*************** enum bitmap_bits {
*** 66,72 ****
  
  /* Global data */
  extern bitmap_element *bitmap_free;	/* Freelist of bitmap elements */
! extern bitmap_element bitmap_zero;	/* Zero bitmap element */
  
  /* Clear a bitmap by freeing up the linked list.  */
  extern void bitmap_clear PARAMS ((bitmap));
--- 66,72 ----
  
  /* Global data */
  extern bitmap_element *bitmap_free;	/* Freelist of bitmap elements */
! extern bitmap_element bitmap_zero_bits;	/* Zero bitmap element */
  
  /* Clear a bitmap by freeing up the linked list.  */
  extern void bitmap_clear PARAMS ((bitmap));


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]