OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / gengtype-state.c
index e6909f2..d265f48 100644 (file)
    and Basile Starynkevitch <basile@starynkevitch.net>
 */
 
+#ifdef GENERATOR_FILE
 #include "bconfig.h"
+#else
+#include "config.h"
+#endif
 #include "system.h"
 #include "errors.h"    /* For fatal.  */
 #include "double-int.h"
@@ -303,7 +307,7 @@ read_a_state_token (void)
       obstack_1grow (&id_obstack, (char) 0);
       ids = XOBFINISH (&id_obstack, char *);
       sid = state_ident_by_name (ids, INSERT);
-      obstack_free (&id_obstack, ids);
+      obstack_free (&id_obstack, NULL);
       ids = NULL;
       tk = XCNEW (struct state_token_st);
       tk->stok_kind = STOK_NAME;
@@ -408,7 +412,7 @@ read_a_state_token (void)
       tk->stok_file = state_path;
       tk->stok_next = NULL;
       strcpy (tk->stok_un.stok_string, cstr);
-      obstack_free (&bstring_obstack, cstr);
+      obstack_free (&bstring_obstack, NULL);
 
       return tk;
     }
@@ -1190,8 +1194,6 @@ write_state (const char *state_path)
   fprintf (state_file,
           ";;; This file should be parsed by the same %s which wrote it.\n",
           progname);
-  fprintf (state_file, ";;; file %s generated on %s\n", state_path,
-          ctime (&now));
   /* The first non-comment significant line gives the version string.  */
   write_state_version (version_string);
   write_state_srcdir ();
@@ -2085,7 +2087,7 @@ static void
 read_state_structures (type_p *structures)
 {
   type_p head = NULL;
-  type_p previous;
+  type_p previous = NULL;
   type_p tmp;
   int nbstruct = 0, countstruct = 0;
   struct state_token_st *t0 = peek_state_token (0);
@@ -2137,7 +2139,7 @@ read_state_param_structs (type_p *param_structs)
   int nbparamstructs = 0;
   int countparamstructs = 0;
   type_p head = NULL;
-  type_p previous;
+  type_p previous = NULL;
   type_p tmp;
   struct state_token_st *t0 = peek_state_token (0);
   struct state_token_st *t1 = peek_state_token (1);
@@ -2385,6 +2387,15 @@ equals_type_number (const void *ty1, const void *ty2)
   return type1->state_number == type2->state_number;
 }
 
+static int
+string_eq (const void *a, const void *b)
+{
+  const char *a0 = (const char *)a;
+  const char *b0 = (const char *)b;
+
+  return (strcmp (a0, b0) == 0);
+}
+
 
 /* The function reading the state, called by main from gengtype.c.  */
 void
@@ -2408,7 +2419,7 @@ read_state (const char *path)
   state_seen_types =
     htab_create (2017, hash_type_number, equals_type_number, NULL);
   state_ident_tab =
-    htab_create (4027, htab_hash_string, (htab_eq) strcmp, NULL);
+    htab_create (4027, htab_hash_string, string_eq, NULL);
   read_state_version (version_string);
   read_state_srcdir ();
   read_state_languages ();