Patch: remove useless allocations from C FE

Tom Tromey tromey@redhat.com
Mon Sep 17 19:03:00 GMT 2007


This patch removes some useless (small) allocations from the C FE.

DECL_LANG_SPECIFIC is not used by the C front end.  So, there's no
reason to allocate it.

Bootstrapped and regtested on x86 FC6.  Ok?

Tom

ChangeLog:
2007-09-17  Tom Tromey  <tromey@redhat.com>

	* c-decl.c (pushdecl): Don't set DECL_LANG_SPECIFIC.
	(c_builtin_function): Likewise.
	(grokdeclarator): Likewise.

Index: c-decl.c
===================================================================
--- c-decl.c	(revision 128478)
+++ c-decl.c	(working copy)
@@ -2071,10 +2071,6 @@
   struct c_binding *b;
   bool nested = false;
 
-  /* Functions need the lang_decl data.  */
-  if (TREE_CODE (x) == FUNCTION_DECL && !DECL_LANG_SPECIFIC (x))
-    DECL_LANG_SPECIFIC (x) = GGC_CNEW (struct lang_decl);
-
   /* Must set DECL_CONTEXT for everything not at file scope or
      DECL_FILE_SCOPE_P won't work.  Local externs don't count
      unless they have initializers (which generate code).  */
@@ -2846,7 +2842,6 @@
   tree   id = DECL_NAME (decl);
 
   const char *name = IDENTIFIER_POINTER (id);
-  DECL_LANG_SPECIFIC (decl) = GGC_CNEW (struct lang_decl);
   C_DECL_BUILTIN_PROTOTYPE (decl) = (TYPE_ARG_TYPES (type) != 0);
 
   /* Should never be called on a symbol with a preexisting meaning.  */
@@ -4825,8 +4820,6 @@
 	decl = build_decl (FUNCTION_DECL, declarator->u.id, type);
 	decl = build_decl_attribute_variant (decl, decl_attr);
 
-	DECL_LANG_SPECIFIC (decl) = GGC_CNEW (struct lang_decl);
-
 	if (pedantic && type_quals && !DECL_IN_SYSTEM_HEADER (decl))
 	  pedwarn ("ISO C forbids qualified function types");
 



More information about the Gcc-patches mailing list