[PATCH] only have varray name with ENABLE_CHECKING

Steven Bosscher s.bosscher@student.tudelft.nl
Fri Nov 21 21:51:00 GMT 2003


We always have a name field for each varray, but it's only used with checking 
enabled.  This patch makes the field disappear with checking disabled.  OK?

Gr.
Steven

	* varray.h (struct varray_head_tag): Remove name field if checking
	is disabled.
	* varray.c (varray_init): Only set the name field when checking is
	enabled.  Mark the name argument unused if checking is not enabled.

Index: varray.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varray.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 varray.c
*** varray.c	19 Jul 2003 14:47:14 -0000	1.21
--- varray.c	21 Nov 2003 21:43:53 -0000
*************** static const struct {
*** 61,69 ****
--- 61,75 ----
  
  /* Allocate a virtual array with NUM_ELEMENT elements, each of which is
     ELEMENT_SIZE bytes long, named NAME.  Array elements are zeroed.  */
+ #ifdef ENABLE_CHECKING
  varray_type
  varray_init (size_t num_elements, enum varray_data_enum element_kind,
  	     const char *name)
+ #else
+ varray_type
+ varray_init (size_t num_elements, enum varray_data_enum element_kind,
+ 	     const char *name ATTRIBUTE_UNUSED)
+ #endif
  {
    size_t data_size = num_elements * element[element_kind].size;
    varray_type ptr;
*************** varray_init (size_t num_elements, enum v
*** 75,81 ****
--- 81,89 ----
    ptr->num_elements = num_elements;
    ptr->elements_used = 0;
    ptr->type = element_kind;
+ #ifdef ENABLE_CHECKING
    ptr->name = name;
+ #endif
    return ptr;
  }
  
Index: varray.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varray.h,v
retrieving revision 1.32
diff -c -3 -p -r1.32 varray.h
*** varray.h	10 Jul 2003 11:38:18 -0000	1.32
--- varray.h	21 Nov 2003 21:43:53 -0000
*************** struct varray_head_tag GTY(()) {
*** 134,140 ****
--- 134,142 ----
    size_t        elements_used;  /* The number of elements used, if
  				   using VARRAY_PUSH/VARRAY_POP.  */
    enum varray_data_enum type;	/* The kind of elements in the varray.  */
+ #ifdef ENABLE_CHECKING
    const char   *name;		/* name of the varray for reporting errors */
+ #endif
    varray_data	GTY ((desc ("%0.type"))) data;	/* The data elements follow,
  						   must be last.  */
  };



More information about the Gcc-patches mailing list