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]

Re: Minor bugfix/improvement for gengtype


On 03 Oct 2006 23:29:05 -0700, Geoffrey Keating <geoffk@apple.com> wrote:
I seem to remember this was intentional, but I don't remember why, so
the patch is OK to commit.  However, it's not a regression, so not
suitable for mainline at this time.

Fair enough; there is no hurry to get this one in. I'll try to remember for when stage 1 opens.

Since we're now talking about stage 1, though, I wonder if I could get
your opinion on two more patches for gengtype.  They are both intended
to make life easier for people trying to debug it (which one spends a
lot of time doing when one is hacking up its parser).  Patch #1 tags
all the generated functions with the file and line of the definition
of the relevant structure, and also attempts to ensure a stable order
for the generated code (very helpful when inspecting diffs of the
generated code).  Patch #2 causes the list of input files to be read
from a text file at runtime rather than compiled into the gengtype
binary, which means that if you know it's crashing on one particular
file, you can easily instruct it to process just that file while
running it under the debugger.

(Patches have been extracted from my local SVK mirror, are almost
certainly offset, and may not be 100% correct as is.)

zw
==================================================================
--- gengtype-lex.l	(revision 117474)
+++ gengtype-lex.l	(local)
@@ -34,7 +34,8 @@ Software Foundation, 51 Franklin Street,
 
 static unsigned macro_input (char *buffer, unsigned);
 static const char *push_macro_expansion (const char *, unsigned,
-					 const char *, unsigned);
+					 const char *, unsigned,
+					 struct fileloc *);
 static char *mangle_macro_name (const char *, unsigned,
        			        const char *, unsigned);
 static void update_lineno (const char *l, size_t len);
@@ -264,7 +265,8 @@ ITYPE	{IWORD}({WS}{IWORD})*
   do_typedef (ptr, t, &lexer_line);
 
   /* Push the macro for later expansion.  */
-  additional = push_macro_expansion (macro, macro_len, arg, arg_len);
+  additional = push_macro_expansion (macro, macro_len, arg, arg_len,
+  	       			     &lexer_line);
 
   if (additional)
     {
@@ -453,6 +455,7 @@ typedef struct macro
   const macro_def_t *def;
   struct macro *next;
   const char *args[10];
+  struct fileloc pos;
 } macro_t;
 
 static const macro_def_t macro_defs[] = 
@@ -471,7 +474,8 @@ static macro_t *macro_expns_end;
 
 static const char *
 push_macro_expansion (const char *name, unsigned name_len,
-		      const char *arg, unsigned arg_len)
+		      const char *arg, unsigned arg_len,
+		      struct fileloc *pos)
 {
   unsigned ix;
 
@@ -485,6 +489,7 @@ push_macro_expansion (const char *name, 
 
 	expansion->def = &macro_defs[ix];
 	expansion->next = NULL;
+	expansion->pos = *pos;
 	args = (char *) xmemdup (arg, arg_len, arg_len+1);
 	args[arg_len] = 0;
         for (argno = 0; *args;)
@@ -580,6 +585,7 @@ macro_input (char *buffer, unsigned size
         }
       if (result > size)
         YY_FATAL_ERROR ("buffer too small to expand macro");
+      lexer_line = macro_expns->pos;
       macro_expns = macro_expns->next;
       if (!macro_expns)
         macro_expns_end = NULL;
==================================================================
--- gengtype.c	(revision 117474)
+++ gengtype.c	(local)
@@ -2070,7 +2073,9 @@ write_func_for_structure (type_p orig_s,
   d.prev_val[3] = "x";
   d.val = "(*x)";
 
-  oprintf (d.of, "\n");
+  oprintf (d.of, "\n/* %s:%d */\n",
+	   d.line->file ? d.line->file + srcdir_len + 1 : "<unknown>",
+	   d.line->line ? d.line->line : 0);
   oprintf (d.of, "void\n");
   if (param == NULL)
     oprintf (d.of, "gt_%sx_%s", wtd->prefix, orig_s->u.s.tag);
@@ -3024,6 +3029,123 @@ write_roots (pair_p variables)
 }
 
 
+
+/* Comparison function for sorting types by file and line of definition.
+   Note that not all types in the list have locations; in an effort to
+   do something sensible there, we give them dummy locations that should
+   compare equal to each other and after all real locations.  */
+static int
+sort_types_qsort_func (const void *a, const void *b)
+{
+  const struct type *x = *(const struct type **) a;
+  const struct type *y = *(const struct type **) b;
+
+  const char *xf = "~~~~~", *yf = "~~~~~";
+  int xl = INT_MAX, yl = INT_MAX;
+  int r;
+
+  if (x->kind == TYPE_STRUCT || x->kind == TYPE_UNION)
+    {
+      if (x->u.s.line.file)
+	{
+	  xf = x->u.s.line.file;
+	  xl = x->u.s.line.line;
+	}
+    }
+  else if (x->kind == TYPE_PARAM_STRUCT)
+    {
+      if (x->u.param_struct.line.file)
+	{
+	  xf = x->u.param_struct.line.file;
+	  xl = x->u.param_struct.line.line;
+	}
+    }
+  if (y->kind == TYPE_STRUCT || y->kind == TYPE_UNION)
+    {
+      if (y->u.s.line.file)
+	{
+	  yf = y->u.s.line.file;
+	  yl = y->u.s.line.line;
+	}
+    }
+  else if (y->kind == TYPE_PARAM_STRUCT)
+    {
+      if (y->u.param_struct.line.file)
+	{
+	  yf = y->u.param_struct.line.file;
+	  yl = y->u.param_struct.line.line;
+	}
+    }
+  r = strcmp (xf, yf);
+  if (r)
+    return r;
+  return xl - yl;
+}
+
+/* Sort CHAIN, a (pointer to a) linked list of type_p structures, by
+   file and line of definition.  */
+static void
+sort_types (type_p *chain)
+{
+  type_p *buf;
+  size_t i, n;
+  type_p p;
+
+  for (p = *chain, n = 0; p; p = p->next)
+    n++;
+  buf = xmalloc (n * sizeof (type_p));
+  for (p = *chain, n = 0; p; p = p->next)
+    buf[n++] = p;
+
+  qsort (buf, n, sizeof (type_p), sort_types_qsort_func);
+
+  for (i = 0; i < n-1; i++)
+    buf[i]->next = buf[i+1];
+  buf[i]->next = 0;
+  *chain = buf[0];
+  free (buf);
+}
+
+/* Comparison function for sorting variables by file and line of
+   definition.  Unlike with types, we don't have to worry about
+   missing locations here.  */
+static int
+sort_vars_qsort_func (const void *a, const void *b)
+{
+  const struct pair *x = *(const struct pair **)a;
+  const struct pair *y = *(const struct pair **)b;
+  int r;
+
+  r = strcmp (x->line.file, y->line.file);
+  if (r)
+    return r;
+  return x->line.line - y->line.line;
+}
+
+/* Sort CHAIN, a (pointer to a) linked list of pair_p structures, by
+   file and line of definition.  */
+static void
+sort_vars (pair_p *chain)
+{
+  pair_p *buf;
+  size_t i, n;
+  pair_p p;
+
+  for (p = *chain, n = 0; p; p = p->next)
+    n++;
+  buf = xmalloc (n * sizeof (pair_p));
+  for (p = *chain, n = 0; p; p = p->next)
+    buf[n++] = p;
+  
+  qsort (buf, n, sizeof (pair_p), sort_vars_qsort_func);
+
+  for (i = 0; i < n-1; i++)
+    buf[i]->next = buf[i+1];
+  buf[i]->next = 0;
+  *chain = buf[0];
+  free (buf);
+}
+
 extern int main (int argc, char **argv);
 int
 main(int ARG_UNUSED (argc), char ** ARG_UNUSED (argv))
@@ -3080,6 +3202,9 @@ main(int ARG_UNUSED (argc), char ** ARG_
     exit (1);
 
   set_gc_used (variables);
+  sort_types (&structures);
+  sort_types (&param_structs);
+  sort_vars (&variables);
 
   open_base_files ();
   write_enum_defn (structures, param_structs);
==================================================================
--- gengtype.c	(revision 114214)
+++ gengtype.c	(revision 114215)
@@ -77,12 +72,70 @@ xasprintf (const char *format, ...)
   return result;
 }
 
+/* Safely read a line of text from a file into malloc-ed memory, no matter how
+   long it is.  The terminating \n is not put into the string.  */
+static char *
+xreadline (FILE *fp)
+{
+  size_t asize = 128;  /* probably long enough for most lines */
+  size_t pos   = 0;
+  char *buf    = xmalloc (asize);
+  int c = -1;
+
+  while (c != '\0')
+    {
+      c = getc (fp);
+      if (c == '\n' || c == EOF)
+	c = '\0';
+      if (pos >= asize)
+	{
+	  asize *= 2;
+	  buf = xrealloc (buf, asize);
+	}
+      buf[pos++] = c;
+    }
+  return xrealloc (buf, pos);
+}
+
 /* The one and only TYPE_STRING.  */
 
 struct type string_type = {
   TYPE_STRING, NULL, NULL, GC_USED, {0}
 };
 
+
+
+
+/* Output file handling.  */
+
+/* Structure representing an output file.  */
+struct outf 
+{
+  struct outf *next;
+  const char *name;
+  size_t buflength;
+  size_t bufused;
+  char *buf;
+};
+
+typedef struct outf * outf_p;
+
+/* An output file, suitable for definitions, that can see declarations
+   made in INPUT_FILE and is linked into every language that uses
+   INPUT_FILE.  */
+static outf_p get_output_file_with_visibility 
+   (const char *input_file);
+static const char *get_output_file_name (const char *);
+
+/* A bitmap that specifies which of BASE_FILES should be used to
+   output a definition that is different for each language and must be
+   defined once in each language that uses INPUT_FILE.  */
+static lang_bitmap get_base_file_bitmap (const char *input_file);
+
+/* Print, like fprintf, to O.  */
+static void oprintf (outf_p o, const char *S, ...)
+     ATTRIBUTE_PRINTF_2;
+
 /* Lists of various things.  */
 
 static pair_p typedefs;
@@ -1078,20 +1133,136 @@ static outf_p output_files;
    source file.  */
 static outf_p header_file;
 
-/* Number of files specified in gtfiles.  */
-#define NUM_GT_FILES (ARRAY_SIZE (all_files) - 1)
+/* The source directory.  */
+static const char *srcdir;
+static ptrdiff_t srcdir_len;
+
+/* All language-specific input files.  */
+static const char **lang_files;
+static size_t num_lang_files;
+
+/* Languages associated with language-specific input files.  */
+static const char **langs_for_lang_files;
+static size_t num_langs_for_lang_files;
+
+/* Language-independent input files.  */
+static const char **all_files;
+static size_t num_all_files;
+
+/* Language directory names.  */
+static const char **lang_dir_names;
+static size_t num_lang_dir_names;
+
+/* Base language output files.  There are as many of these as there are
+   language directories.  */
+static outf_p *base_files;
+#define num_base_files num_lang_dir_names
+
+static const struct input_stanza
+{
+  const char *tag;
+  const char ***arrayp;
+  size_t *lengthp;
+}
+input_stanzas[] =
+{
+  { ":lang_files:", &lang_files, &num_lang_files },
+  { ":langs_for_lang_files:", &langs_for_lang_files, &num_langs_for_lang_files },
+  { ":all_files:", &all_files, &num_all_files },
+  { ":lang_dir_names:", &lang_dir_names, &num_lang_dir_names },
+};
+#define end_input_stanzas (input_stanzas + ARRAY_SIZE (input_stanzas))
+
+/* Read the file containing all the above lists, FP.  The format of
+   this file is a "stanza" tag - one of the above keywords, on a line
+   by itself, surrounded by colons - followed by one or more lines of
+   text, each of which becomes an entry in the array selected by the
+   stanza tag.  Entirely blank lines, and lines whose first character
+   is '#', are ignored.  So, for example,
+
+     :lang_files:
+     c-common.c
+     c-common.h
+     c-lex.c
+     c-pragma.c
+
+   would load the four files c-common.c, c-common.h, c-lex.c, and
+   c-pragma.c into the lang_files array.  A correct input-lists file
+   must specify all four arrays exactly once, but the order of stanzas
+   does not matter.  */
+static void
+read_input_list (FILE *fp)
+{
+  const struct input_stanza *cur_input_stanza = 0;
+  char *line;
+  size_t pos = 0, asize = 0;
+  char **abuf = 0;
+
+  while (!feof (fp))
+    {
+      line = xreadline (fp);
+      if (line[0] == '#' || line[0] == '\0')
+	free (line);  /* comment */
+      else if (line[0] == ':')
+	{
+	  if (cur_input_stanza)
+	    {
+	      abuf = xrealloc (abuf, (pos+1)*sizeof(char *));
+	      abuf[pos] = 0;
+	      *cur_input_stanza->arrayp = (const char **)abuf;
+	      *cur_input_stanza->lengthp = pos;
+	    }
+	  for (cur_input_stanza = input_stanzas;
+	       cur_input_stanza < end_input_stanzas;
+	       cur_input_stanza++)
+	    if (!strcmp (line, cur_input_stanza->tag))
+	      break;
+	  if (cur_input_stanza == end_input_stanzas)
+	    fatal ("unrecognized input stanza \"%s\"", line);
+	  if (*cur_input_stanza->arrayp)
+	    fatal ("input stanza \"%s\" specified twice", line);
+
+	  asize = 64;
+	  abuf = xmalloc (asize*sizeof(char *));
+	  pos = 0;
+	  free (line);
+	}
+      else
+	{
+	  if (!cur_input_stanza)
+	    fatal ("filename appears before any stanza specifier");
+
+	  if (pos >= asize)
+	    {
+	      asize *= 2;
+	      abuf = xrealloc (abuf, asize*sizeof(char *));
+	    }
+	  abuf[pos++] = line;
+	}
+    }
 
-/* Number of files in the language files array.  */
-#define NUM_LANG_FILES (ARRAY_SIZE (lang_files) - 1)
+  if (cur_input_stanza)
+    {
+      abuf = xrealloc (abuf, (pos+1)*sizeof(char *));
+      abuf[pos] = 0;
+      *cur_input_stanza->arrayp = (const char **)abuf;
+      *cur_input_stanza->lengthp = pos;
+    }
 
-/* Length of srcdir name.  */
-static int srcdir_len = 0;
+  for (cur_input_stanza = input_stanzas;
+       cur_input_stanza < end_input_stanzas;
+       cur_input_stanza++)
+    if (*cur_input_stanza->arrayp == 0)
+      fatal ("%s stanza missing in input list", cur_input_stanza->tag);
 
-#define NUM_BASE_FILES (ARRAY_SIZE (lang_dir_names) - 1)
-outf_p base_files[NUM_BASE_FILES];
+  if (num_lang_files != num_langs_for_lang_files)
+    fatal (":lang_files: and :langs_for_lang_files: stanzas "
+	   "must be the same length (%d/%d)", num_lang_files,
+	   num_langs_for_lang_files);
 
-static outf_p create_file (const char *, const char *);
-static const char * get_file_basename (const char *);
+  base_files = xcalloc (sizeof(outf_p), num_lang_dir_names);
+  fclose (fp);
+}
 
 /* Create and return an outf_p for a new file for NAME, to be called
    ONAME.  */
@@ -1172,7 +1343,7 @@ open_base_files (void)
 
   header_file = create_file ("GCC", "gtype-desc.h");
 
-  for (i = 0; i < NUM_BASE_FILES; i++)
+  for (i = 0; i < num_base_files; i++)
     base_files[i] = create_file (lang_dir_names[i],
 				 xasprintf ("gtype-%s.h", lang_dir_names[i]));
 
@@ -1212,7 +1383,7 @@ get_file_basename (const char *f)
 
   basename++;
 
-  for (i = 1; i < NUM_BASE_FILES; i++)
+  for (i = 1; i < num_base_files; i++)
     {
       const char * s1;
       const char * s2;
@@ -1242,7 +1413,7 @@ get_file_basename (const char *f)
    a linker error will result.  If it wrongly assumes a file _is not_ used,
    some GC roots may be missed, which is a much harder-to-debug problem.  */
 
-unsigned
+static unsigned
 get_base_file_bitmap (const char *input_file)
 {
   const char *basename = get_file_basename (input_file);
@@ -1258,7 +1429,7 @@ get_base_file_bitmap (const char *input_
   if (slashpos)
     {
       size_t i;
-      for (i = 1; i < NUM_BASE_FILES; i++)
+      for (i = 1; i < num_base_files; i++)
 	if ((size_t)(slashpos - basename) == strlen (lang_dir_names [i])
 	    && memcmp (basename, lang_dir_names[i], strlen (lang_dir_names[i])) == 0)
           {
@@ -1272,11 +1443,11 @@ get_base_file_bitmap (const char *input_
 
   bitmap = 0;
 
-  for (j = 0; j < NUM_LANG_FILES; j++)
+  for (j = 0; j < num_lang_files; j++)
     {
       if (!strcmp(input_file, lang_files[j]))
         {
-          for (k = 0; k < NUM_BASE_FILES; k++)
+          for (k = 0; k < num_base_files; k++)
             {
               if (!strcmp(lang_dir_names[k], langs_for_lang_files[j]))
                 bitmap |= (1 << k);
@@ -1286,7 +1457,7 @@ get_base_file_bitmap (const char *input_
 
   /* Otherwise, set all languages.  */
   if (!bitmap)
-    bitmap = (1 << NUM_BASE_FILES) - 1;
+    bitmap = (1 << num_base_files) - 1;
 
   return bitmap;
 }
@@ -1295,7 +1466,7 @@ get_base_file_bitmap (const char *input_
    made in INPUT_FILE and is linked into every language that uses
    INPUT_FILE.  */
 
-outf_p
+static outf_p
 get_output_file_with_visibility (const char *input_file)
 {
   outf_p r;
@@ -1352,7 +1523,7 @@ get_output_file_with_visibility (const c
     {
       size_t i;
 
-      for (i = 0; i < NUM_BASE_FILES; i++)
+      for (i = 0; i < num_base_files; i++)
 	if (memcmp (basename, lang_dir_names[i], strlen (lang_dir_names[i])) == 0
 	    && basename[strlen(lang_dir_names[i])] == '/')
 	  return base_files[i];
@@ -1376,7 +1547,7 @@ get_output_file_with_visibility (const c
    declarations made in INPUT_FILE and is linked into every language
    that uses INPUT_FILE.  */
 
-const char *
+static const char *
 get_output_file_name (const char *input_file)
 {
   return get_output_file_with_visibility (input_file)->name;
@@ -2610,7 +2781,7 @@ finish_root_table (struct flist *flp, co
 
   {
     size_t fnum;
-    for (fnum = 0; fnum < NUM_BASE_FILES; fnum++)
+    for (fnum = 0; fnum < num_base_files; fnum++)
       oprintf (base_files [fnum],
 	       "const struct %s * const %s[] = {\n",
 	       tname, name);
@@ -2636,7 +2807,7 @@ finish_root_table (struct flist *flp, co
 
   {
     size_t fnum;
-    for (fnum = 0; fnum < NUM_BASE_FILES; fnum++)
+    for (fnum = 0; fnum < num_base_files; fnum++)
       {
 	oprintf (base_files[fnum], "  NULL\n");
 	oprintf (base_files[fnum], "};\n");
@@ -3107,15 +3278,30 @@ write_roots (pair_p variables)
 
 extern int main (int argc, char **argv);
 int
-main(int ARG_UNUSED (argc), char ** ARG_UNUSED (argv))
+main(int argc, char **argv)
 {
   unsigned i;
   static struct fileloc pos = { __FILE__, __LINE__ };
   unsigned j;
 
-  gen_rtx_next ();
+  progname = argv[0];
 
+  if (argc < 2 || argc > 3)
+    fatal ("usage: gengtype srcdir [input-list]");
+  srcdir = argv[1];
   srcdir_len = strlen (srcdir);
+  if (argc == 3)
+    {
+      FILE *in = fopen (argv[2], "r");
+      if (!in)
+	fatal ("%s: %s", argv[2], strerror (errno));
+
+      read_input_list (in);
+    }
+  else
+    read_input_list (stdin);
+
+  gen_rtx_next ();
 
   do_scalar_typedef ("CUMULATIVE_ARGS", &pos);
   do_scalar_typedef ("REAL_VALUE_TYPE", &pos);
@@ -3135,7 +3321,7 @@ main(int ARG_UNUSED (argc), char ** ARG_
 	      create_scalar_type ("unsigned long", strlen ("unsigned long")),
 	      "2"), &pos);
 
-  for (i = 0; i < NUM_GT_FILES; i++)
+  for (i = 0; i < num_all_files; i++)
     {
       int dupflag = 0;
       /* Omit if already seen.  */
==================================================================
--- gengtype.h	(revision 114214)
+++ gengtype.h	(revision 114215)
@@ -191,37 +193,3 @@ enum {
   GENGTYPE_TOKENS
 #undef GGTK
 };
-
-/* Output file handling.  */
-
-/* Structure representing an output file.  */
-struct outf 
-{
-  struct outf *next;
-  const char *name;
-  size_t buflength;
-  size_t bufused;
-  char *buf;
-};
-
-typedef struct outf * outf_p;
-
-/* An output file, suitable for definitions, that can see declarations
-   made in INPUT_FILE and is linked into every language that uses
-   INPUT_FILE.  */
-extern outf_p get_output_file_with_visibility 
-   (const char *input_file);
-const char *get_output_file_name (const char *);
-
-/* A list of output files suitable for definitions.  There is one
-   BASE_FILES entry for each language.  */
-extern outf_p base_files[];
-
-/* A bitmap that specifies which of BASE_FILES should be used to
-   output a definition that is different for each language and must be
-   defined once in each language that uses INPUT_FILE.  */
-extern lang_bitmap get_base_file_bitmap (const char *input_file);
-
-/* Print, like fprintf, to O.  */
-extern void oprintf (outf_p o, const char *S, ...)
-     ATTRIBUTE_PRINTF_2;
==================================================================
--- Makefile.in	(revision 114214)
+++ Makefile.in	(revision 114215)
@@ -1028,7 +1028,7 @@ STAGECOPYSTUFF = insn-flags.h insn-confi
  insn-attr.h insn-attrtab.c insn-opinit.c insn-preds.c insn-constants.h \
  tm-preds.h tm-constrs.h \
  tree-check.h min-insn-modes.c insn-modes.c insn-modes.h \
- genrtl.c genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-gen.h
+ genrtl.c genrtl.h gt-*.h gtype-*.h gtype-desc.c gtyp-gen.lst
 
 # Files to be moved away after each stage in building.
 STAGEMOVESTUFF = *$(objext) s-* \
@@ -2889,33 +2889,27 @@ gt-tree-ssa-structalias.h \
 gt-stringpool.h gt-targhooks.h gt-omp-low.h : s-gtype ; @true
 
 define echo_quoted_to_gtyp
- echo "\"$(gtyp)\", " >> tmp-gtyp.h
+ echo "$(gtyp)" >> tmp-gtyp.lst
 
 endef
 
-gtyp-gen.h: s-gtyp-gen ; @true
+gtyp-gen.lst: s-gtyp-gen ; @true
 s-gtyp-gen: Makefile
-	echo "/* This file is machine generated.  Do not edit.  */" > tmp-gtyp.h
-	echo "static const char *const srcdir = "  >> tmp-gtyp.h
-	echo "\"$(GTFILES_SRCDIR)\"" >> tmp-gtyp.h
-	echo ";" >> tmp-gtyp.h
-	echo "static const char *const lang_files[] = {" >> tmp-gtyp.h
+	echo "# This file is machine generated.  Do not edit." > tmp-gtyp.lst
+	echo ":lang_files:" >> tmp-gtyp.lst
 	$(foreach gtyp,$(GTFILES_FILES_FILES),$(echo_quoted_to_gtyp))
-	echo "NULL};" >> tmp-gtyp.h
-	echo "static const char *const langs_for_lang_files[] = {" >> tmp-gtyp.h
+	echo ":langs_for_lang_files:" >> tmp-gtyp.lst
 	$(foreach gtyp,$(GTFILES_FILES_LANGS),$(echo_quoted_to_gtyp))
-	echo "NULL};" >> tmp-gtyp.h
-	echo "static const char *const all_files[] = {" >> tmp-gtyp.h
+	echo ":all_files:" >> tmp-gtyp.lst
 	$(foreach gtyp,$(GTFILES),$(echo_quoted_to_gtyp))
-	echo " NULL};" >> tmp-gtyp.h
-	echo "static const char *const lang_dir_names[] = { \"c\", " >> tmp-gtyp.h
+	echo ":lang_dir_names:" >> tmp-gtyp.lst
+	echo "c" >> tmp-gtyp.lst
 	$(foreach gtyp,$(GTFILES_LANG_DIR_NAMES),$(echo_quoted_to_gtyp))
-	echo "NULL};" >> tmp-gtyp.h
-	$(SHELL) $(srcdir)/../move-if-change tmp-gtyp.h gtyp-gen.h
+	$(SHELL) $(srcdir)/../move-if-change tmp-gtyp.lst gtyp-gen.lst
 	$(STAMP) s-gtyp-gen
 
-s-gtype: build/gengtype$(build_exeext) $(GTFILES)
-	$(RUN_GEN) build/gengtype$(build_exeext)
+s-gtype: build/gengtype$(build_exeext) $(GTFILES) gtyp-gen.lst
+	$(RUN_GEN) build/gengtype$(build_exeext) $(GTFILES_SRCDIR) gtyp-gen.lst
 	$(STAMP) s-gtype
 
 #
@@ -2978,7 +2972,7 @@ build/gengenrtl.o : gengenrtl.c $(BCONFI
 build/gengtype-parse.o : gengtype-parse.c gengtype.h $(BCONFIG_H)	\
   $(SYSTEM_H)
 build/gengtype.o : gengtype.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
-  $(GTM_H) gengtype.h gtyp-gen.h rtl.def insn-notes.def errors.h
+  $(GTM_H) gengtype.h rtl.def insn-notes.def errors.h
 build/genmddeps.o: genmddeps.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h	\
   $(GTM_H) $(RTL_BASE_H) errors.h gensupport.h
 build/genmodes.o : genmodes.c $(BCONFIG_H) $(SYSTEM_H) errors.h		\
@@ -3527,7 +3521,7 @@ mostlyclean: lang.mostlyclean
 # Delete core dumps.
 	-rm -f core */core
 # Delete file generated for gengtype.c
-	-rm -f gtyp-gen.h
+	-rm -f gtyp-gen.lst
 # Delete files generated by gengtype.c
 	-rm -f gtype-*
 	-rm -f gt-*

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