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]
Other format: [Raw text]

[mainline,obvious] Use symbolic constants in cgraph.c


Hello,

this patch uses symbolic constants NO_INSERT/INSERT instead of 0/1.
It also fixes thinko in cgraph_remove_node where INSERT was used but
NO_INSERT should be used.

Bootstrapped/regtested x86-64.
I'm commiting it as obvious.

Josef

	* cgraph.c (cgraph_node): Use INSERT instead of 1 in
	htab_find_slot_with_hash.
	(cgraph_node_for_identifier): Use NO_INSERT.
	(cgraph_remove_node): Use NO_INSERT.
	(cgraph_varpool_node): Use INSERT.
	(cgraph_varpool_node_for_identifier): Use NO_INSERT.

Index: cgraph.c
===================================================================
RCS file: /cvs/gcc-cvs/gcc/gcc/cgraph.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 cgraph.c
*** cgraph.c	26 Sep 2003 00:14:28 -0000	1.31
--- cgraph.c	2 Oct 2003 05:21:43 -0000
*************** cgraph_node (tree decl)
*** 106,112 ****
    slot = (struct cgraph_node **)
      htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (decl),
  			      IDENTIFIER_HASH_VALUE
! 			        (DECL_ASSEMBLER_NAME (decl)), 1);
    if (*slot)
      return *slot;
    node = ggc_alloc_cleared (sizeof (*node));
--- 106,112 ----
    slot = (struct cgraph_node **)
      htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (decl),
  			      IDENTIFIER_HASH_VALUE
! 			        (DECL_ASSEMBLER_NAME (decl)), INSERT);
    if (*slot)
      return *slot;
    node = ggc_alloc_cleared (sizeof (*node));
*************** cgraph_node_for_identifier (tree id)
*** 142,148 ****
  
    slot = (struct cgraph_node **)
      htab_find_slot_with_hash (cgraph_hash, id,
! 			      IDENTIFIER_HASH_VALUE (id), 0);
    if (!slot)
      return NULL;
    return *slot;
--- 142,148 ----
  
    slot = (struct cgraph_node **)
      htab_find_slot_with_hash (cgraph_hash, id,
! 			      IDENTIFIER_HASH_VALUE (id), NO_INSERT);
    if (!slot)
      return NULL;
    return *slot;
*************** cgraph_remove_node (struct cgraph_node *
*** 228,234 ****
    slot = 
      htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (node->decl),
  			      IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME
! 						     (node->decl)), 1);
    htab_clear_slot (cgraph_hash, slot);
    /* Do not free the structure itself so the walk over chain can continue.  */
  }
--- 228,234 ----
    slot = 
      htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (node->decl),
  			      IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME
! 						     (node->decl)), NO_INSERT);
    htab_clear_slot (cgraph_hash, slot);
    /* Do not free the structure itself so the walk over chain can continue.  */
  }
*************** cgraph_varpool_node (tree decl)
*** 433,439 ****
    slot = (struct cgraph_varpool_node **)
      htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl),
  			      IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (decl)),
! 			      1);
    if (*slot)
      return *slot;
    node = ggc_alloc_cleared (sizeof (*node));
--- 433,439 ----
    slot = (struct cgraph_varpool_node **)
      htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl),
  			      IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (decl)),
! 			      INSERT);
    if (*slot)
      return *slot;
    node = ggc_alloc_cleared (sizeof (*node));
*************** cgraph_varpool_node_for_identifier (tree
*** 458,464 ****
  
    slot = (struct cgraph_varpool_node **)
      htab_find_slot_with_hash (cgraph_varpool_hash, id,
! 			      IDENTIFIER_HASH_VALUE (id), 0);
    if (!slot)
      return NULL;
    return *slot;
--- 458,464 ----
  
    slot = (struct cgraph_varpool_node **)
      htab_find_slot_with_hash (cgraph_varpool_hash, id,
! 			      IDENTIFIER_HASH_VALUE (id), NO_INSERT);
    if (!slot)
      return NULL;
    return *slot;


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