]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/gengtype-state.c
[Ada] Get rid of more references to Universal_Integer in expanded code
[thirdparty/gcc.git] / gcc / gengtype-state.c
index ef7713ff06a0beedd97933054b293366500008e9..d1d54e9de7d6519408dc777ee9e4193223db07ff 100644 (file)
@@ -1,7 +1,7 @@
 /* Gengtype persistent state serialization & de-serialization.
    Useful for gengtype in plugin mode.
 
-   Copyright (C) 2010-2013 Free Software Foundation, Inc.
+   Copyright (C) 2010-2020 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
    and Basile Starynkevitch <basile@starynkevitch.net>
 */
 
-#ifdef GENERATOR_FILE
-#include "bconfig.h"
-#else
+#ifdef HOST_GENERATOR_FILE
 #include "config.h"
+#define GENERATOR_FILE 1
+#else
+#include "bconfig.h"
 #endif
 #include "system.h"
 #include "errors.h"    /* For fatal.  */
-#include "double-int.h"
-#include "hashtab.h"
 #include "version.h"   /* For version_string & pkgversion_string.  */
 #include "obstack.h"
 #include "gengtype.h"
@@ -54,8 +53,6 @@ type_lineloc (const_type_p ty)
     case TYPE_USER_STRUCT:
     case TYPE_UNDEFINED:
       return CONST_CAST (struct fileloc*, &ty->u.s.line);
-    case TYPE_PARAM_STRUCT:
-      return CONST_CAST (struct fileloc*, &ty->u.param_struct.line);
     case TYPE_SCALAR:
     case TYPE_STRING:
     case TYPE_POINTER:
@@ -180,7 +177,6 @@ private:
   void write_state_user_struct_type (type_p current);
   void write_state_union_type (type_p current);
   void write_state_lang_struct_type (type_p current);
-  void write_state_param_struct_type (type_p current);
   void write_state_pointer_type (type_p current);
   void write_state_array_type (type_p current);
   void write_state_gc_used (enum gc_used_enum gus);
@@ -190,7 +186,6 @@ private:
   int write_state_pair_list (pair_p list);
   void write_state_typedefs (void);
   void write_state_structures (void);
-  void write_state_param_structs (void);
   void write_state_variables (void);
   void write_state_srcdir (void);
   void write_state_files_list (void);
@@ -283,7 +278,7 @@ state_writer::state_writer ()
 
 
 /* Fatal message while reading state.  */
-static inline void 
+static void 
 fatal_reading_state (struct state_token_st* tok, const char*msg)
 {
   if (tok)
@@ -635,7 +630,6 @@ state_token_is_name (struct state_token_st *p, const char *name)
  * We want to serialize :
  *          - typedefs list
  *          - structures list
- *          - param_structs list
  *          - variables list
  *
  * So, we have one routine for each kind of data.  The main writing
@@ -1023,29 +1017,6 @@ state_writer::write_state_lang_struct_type (type_p current)
   end_s_expr ();
 }
 
-/* Write a parametrized structure GTY type.  */
-void
-state_writer::write_state_param_struct_type (type_p current)
-{
-  int i;
-
-  write_any_indent (0);
-  fprintf (state_file, "param_struct ");
-  write_state_common_type_content (current);
-  write_state_type (current->u.param_struct.stru);
-  for (i = 0; i < NUM_PARAM; i++)
-    {
-      if (current->u.param_struct.param[i] != NULL)
-       write_state_type (current->u.param_struct.param[i]);
-      else
-       {
-         write_any_indent (0);
-         fprintf (state_file, "nil ");
-       }
-    }
-  write_state_fileloc (&current->u.param_struct.line);
-}
-
 /* Write a pointer type.  */
 void
 state_writer::write_state_pointer_type (type_p current)
@@ -1166,9 +1137,6 @@ state_writer::write_state_type (type_p current)
        case TYPE_LANG_STRUCT:
          write_state_lang_struct_type (current);
          break;
-       case TYPE_PARAM_STRUCT:
-         write_state_param_struct_type (current);
-         break;
        case TYPE_SCALAR:
          write_state_scalar_type (current);
          break;
@@ -1225,10 +1193,9 @@ state_writer::write_state_pair_list (pair_p list)
 
 }
 
-/* When writing imported linked lists, like typedefs, structures,
-   param_structs, ... we count their length first and write it.  These
-   eases the reading, and enables an extra verification on the number
-   of actually read items.  */
+/* When writing imported linked lists, like typedefs, structures, ... we count
+   their length first and write it.  This eases the reading, and enables an
+   extra verification on the number of actually read items.  */
 
 /* Write our typedefs.  */
 void
@@ -1270,25 +1237,6 @@ state_writer::write_state_structures (void)
     printf ("%s wrote %d structures in state\n", progname, nbstruct);
 }
 
-/* Write our param_struct-s.  */
-void
-state_writer::write_state_param_structs (void)
-{
-  int nbparamstruct = 0;
-  type_p current;
-
-  for (current = param_structs; current != NULL; current = current->next)
-    nbparamstruct++;
-
-  begin_s_expr ("param_structs");
-  fprintf (state_file, "%d", nbparamstruct);
-
-  for (current = param_structs; current != NULL; current = current->next)
-    write_state_type (current);
-
-  end_s_expr ();
-}
-
 /* Write our variables.  */
 void
 state_writer::write_state_variables (void)
@@ -1425,7 +1373,6 @@ write_state (const char *state_path)
   sw.write_state_files_list ();
   sw.write_state_structures ();
   sw.write_state_typedefs ();
-  sw.write_state_param_structs ();
   sw.write_state_variables ();
   write_state_trailer ();
   statelen = ftell (state_file);
@@ -1810,34 +1757,6 @@ read_state_lang_struct_type (type_p type)
 }
 
 
-/* Read a param_struct type for GTY parametrized structures.  */
-static void
-read_state_param_struct_type (type_p type)
-{
-  int i;
-  struct state_token_st *t0;
-
-  type->kind = TYPE_PARAM_STRUCT;
-  read_state_common_type_content (type);
-  DBGPRINTF ("read param_struct type @%p #%d",
-            (void *) type, type->state_number);
-  read_state_type (&(type->u.param_struct.stru));
-
-  for (i = 0; i < NUM_PARAM; i++)
-    {
-      t0 = peek_state_token (0);
-      if (state_token_is_name (t0, "nil"))
-       {
-         type->u.param_struct.param[i] = NULL;
-         next_state_tokens (1);
-       }
-      else
-       read_state_type (&(type->u.param_struct.param[i]));
-    }
-  read_state_fileloc (&(type->u.param_struct.line));
-}
-
-
 /* Read the gc used information.  */
 static void
 read_state_gc_used (enum gc_used_enum *pgus)
@@ -1939,12 +1858,6 @@ read_state_type (type_p *current)
              next_state_tokens (1);
              read_state_lang_struct_type (*current);
            }
-         else if (state_token_is_name (t0, "param_struct"))
-           {
-             *current = XCNEW (struct type);
-             next_state_tokens (1);
-             read_state_param_struct_type (*current);
-           }
          else if (state_token_is_name (t0, "pointer"))
            {
              *current = XCNEW (struct type);
@@ -2293,7 +2206,7 @@ read_state_pair (pair_p *current)
          next_state_tokens (1);
          read_state_type (&((*current)->type));
          read_state_fileloc (&((*current)->line));
-         read_state_options (&((*current)->opt));;
+         read_state_options (&((*current)->opt));
          t0 = peek_state_token (0);
          if (state_token_kind (t0) == STOK_RIGHTPAR)
            {
@@ -2440,58 +2353,6 @@ read_state_structures (type_p *structures)
 }
 
 
-/* Read the param_struct-s.  */
-static void
-read_state_param_structs (type_p *param_structs)
-{
-  int nbparamstructs = 0;
-  int countparamstructs = 0;
-  type_p head = NULL;
-  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);
-  struct state_token_st *t2 = peek_state_token (2);
-
-  if (state_token_kind (t0) == STOK_LEFTPAR
-      && state_token_is_name (t1, "!param_structs")
-      && state_token_kind (t2) == STOK_INTEGER)
-    {
-      nbparamstructs = t2->stok_un.stok_num;
-      next_state_tokens (3);
-      t0 = t1 = t2 = NULL;
-      t0 = peek_state_token (0);
-      while (state_token_kind (t0) != STOK_RIGHTPAR)
-       {
-         tmp = NULL;
-         read_state_type (&tmp);
-         if (head == NULL)
-           {
-             head = tmp;
-             previous = head;
-           }
-         else
-           {
-             previous->next = tmp;
-             previous = tmp;
-           }
-         t0 = peek_state_token (0);
-         countparamstructs++;
-       }
-      next_state_tokens (1);
-    }
-  else
-    fatal_reading_state (t0, "Bad param_structs syntax");
-  t0 = peek_state_token (0);
-  if (countparamstructs != nbparamstructs)
-    fatal_reading_state_printf
-      (t0,
-       "invalid number of param_structs expected %d got %d",
-       nbparamstructs, countparamstructs);
-  *param_structs = head;
-}
-
-
 /* Read the variables.  */
 static void
 read_state_variables (pair_p *variables)
@@ -2738,7 +2599,6 @@ read_state (const char *path)
       (NULL_STATE_TOKEN, "input error while reading state [%s]",
        xstrerror (errno));
   read_state_typedefs (&typedefs);
-  read_state_param_structs (&param_structs);
   read_state_variables (&variables);
   read_state_trailer ();