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]

[incremental] Patch: FYI: fixlets for bootstrap


I'm checking this in on the incremental-compiler branch.

This fixes various minor bugs that were breaking bootstrap.
With this I can do a (C only) bootstrap again.

The only noteworthy thing in here are a couple of logic fixes to
c_parser_translation_unit.  One is to work around a bug in
c_parser_find_decl_boundary -- this function does not properly
handle K&R-style function definitions.  Pending a rewrite of this, we
work around the problem.

The other fix is to avoid failures in odd cases involving transitions
between different kinds of hunk bounds finding.

Tom

ChangeLog:
2007-11-28  Tom Tromey  <tromey@redhat.com>

	* c-parser.c (c_parser_translation_unit): Handle a wrong guess by
	c_parser_find_decl_boundary.  Only set parsed_any if a new hunk
	was started.
	* server.c (server_start): Move declaration to start of function.
	* ggc-page.c (gt_ggc_m_S): Cast argument to
	gt_ggc_mx_lang_tree_node.
	* c-decl.c (c_gimple_diagnostics_recursively): Comment out.
	* c-format.c (handle_format_attribute): Copy format_types_orig.
	* gengtype.c (write_root): Cast gt_ggc_m_S to gt_pointer_walker.
	* dwarf2out.c (equate_type_number_to_die): Move declaration to
	start of function.

Index: gengtype.c
===================================================================
--- gengtype.c	(revision 130454)
+++ gengtype.c	(working copy)
@@ -3261,7 +3261,7 @@
 	oprintf (f, "sizeof (%s)", v->name);
 	end_root_field (f, v, false);
 	start_root_field (f, v, "cb");
-	oprintf (f, "&gt_ggc_m_S");
+	oprintf (f, "(gt_pointer_walker) &gt_ggc_m_S");
 	end_root_field (f, v, false);
 	start_root_field (f, v, "pchw");
 	oprintf (f, "(gt_pointer_walker) &gt_pch_n_S");
Index: c-format.c
===================================================================
--- c-format.c	(revision 130053)
+++ c-format.c	(working copy)
@@ -2895,7 +2895,7 @@
 	 format_type data is allocated dynamically and is modifiable.  */
       if (!dynamic_format_types)
 	format_types = dynamic_format_types = (format_kind_info *)
-	  obdup_mem (dynamic_format_types, sizeof (format_types_orig));
+	  obdup_mem (format_types_orig, sizeof (format_types_orig));
 
       /* If this is format __asm_fprintf__, we have to initialize
 	 GCC's notion of HOST_WIDE_INT for checking %wd.  */
Index: dwarf2out.c
===================================================================
--- dwarf2out.c	(revision 130053)
+++ dwarf2out.c	(working copy)
@@ -5732,10 +5732,11 @@
 static inline void
 equate_type_number_to_die (tree type, dw_die_ref type_die)
 {
+  void **slot;
   struct type_die_entry *entry = GGC_NEW (struct type_die_entry);
   entry->type = type;
   entry->die = type_die;
-  void **slot = htab_find_slot (type_die_table, entry, INSERT);
+  slot = htab_find_slot (type_die_table, entry, INSERT);
   *slot = entry;
 }
 
Index: server.c
===================================================================
--- server.c	(revision 130053)
+++ server.c	(working copy)
@@ -102,9 +102,10 @@
     default:
       {
 	/* Parent.  */
+	int r;
 	char x;
 	close (fds[1]);
-	int r = read (fds[0], &x, 1);
+	r = read (fds[0], &x, 1);
 	if (r == -1)
 	  error ("server failed to start: %s", xstrerror (errno));
 	close (fds[0]);
Index: c-decl.c
===================================================================
--- c-decl.c	(revision 130473)
+++ c-decl.c	(working copy)
@@ -6956,6 +6956,7 @@
 /* Emit diagnostics that require gimple input for detection.  Operate on
    FNDECL and all its nested functions.  */
 
+#if 0
 static void
 c_gimple_diagnostics_recursively (tree fndecl)
 {
@@ -6973,6 +6974,7 @@
   for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested)
     c_gimple_diagnostics_recursively (cgn->decl);
 }
+#endif
 
 /* Finish up a function declaration and compile that function
    all the way to assembler language output.  The free the storage
Index: ggc-page.c
===================================================================
--- ggc-page.c	(revision 130473)
+++ ggc-page.c	(working copy)
@@ -1302,7 +1302,7 @@
 			     + offsetof (struct ht_identifier, str))
 		  || offset == offsetof (struct tree_string, str));
       p = ((const char *) p) - offset;
-      gt_ggc_mx_lang_tree_node (p);
+      gt_ggc_mx_lang_tree_node ((void *) p);
       return;
     }
 
Index: c-parser.c
===================================================================
--- c-parser.c	(revision 130473)
+++ c-parser.c	(working copy)
@@ -2138,9 +2138,13 @@
 		      start_new_parsed_hunk (parser, 1,
 					     parser->buffer[isolani.start_token].location);
 		      c_parser_external_declaration (parser);
-		      finish_current_hunk (parser, &isolani, &isolani,
-					   parser->current_hset);
-		      gcc_assert (parser->next_token == isolani.next_token + 1);
+		      /* FIXME: c_parser_find_decl_boundary might have
+			 guessed incorrectly -- it is known to fail
+			 for K&R function definitions.  In this case
+			 we can't add the parsed hunk.  */
+		      if (parser->next_token == isolani.next_token + 1)
+			finish_current_hunk (parser, &isolani, &isolani,
+					     parser->current_hset);
 		    }
 		  /* Defensiveness.  */
 		  parser->current_hset = NULL;
@@ -2170,11 +2174,13 @@
 	      /* Couldn't reuse, so parse and save this hunk.  */
 	      start_new_parsed_hunk (parser, 20,
 				     parser->buffer[parser->prev_hunk->start_token].location);
+
+	      /* Only set this if we just started a new hunk.  */
+	      parsed_any = true;
 	    }
 
 	  c_parser_external_declaration (parser);
 	  obstack_free (&parser_obstack, obstack_position);
-	  parsed_any = true;
 	}
       while (c_parser_next_token_is_not (parser, CPP_EOF));
     }


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