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: enhancing gengtype for plugins?


On Wed, Jun 03, 2009 at 11:07:45AM +0200, Basile Starynkevitch wrote:
> Dear All,
> 
> I suggest to enhance the gengtype generator, so that,
> 
> 1. It behaves as usual with the two arguments (sourcedir and filelist)
> -hence nothing is broken...
> 
> 2. In addition, when invoked as
>    gengtype -p sourcedir filelist plugin.c 
> where the sourcedir & filelist is as usual, and the plugin.c is a new file
> inside a plugin (not listed in the filelist), its generates a gt-plugin.h
> for the GTY stuff used in plugin.c


I forgot to say that I did test my just posted patch in the following way

1. It bootstraps, so the usual gengtype behavior is kept (and did not change).

2. I did run it on a small example. by running in a temporary directory containing my-gtyp-input.list and testgt.c

   gengtype -p $GCCSRCDIR/gcc my-gtyp-input.list testgt.c

where my-gtyp-input.list is the sama as gtyp-input.list in the build
directory, except that I had to change the lines for auto-host.h & options.h
by putting their absolute path (these are generated files in the build
directory, and I had to give their absolute path).

The testgt.c file is just

########################################
// file testgt.c
struct GTY(()) foo_st {
  tree tr;
  edge ed;
  unsigned long ix;
}

static GTY(()) struct foo_st *foo_ptr;
########################################


and indeed the gt-testgt.h file is generated as 

########################################
/* Type information for testgt.c.
   Copyright (C) 2004, 2007, 2009 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */

/* This file is machine generated.  Do not edit.  */

void
gt_ggc_mx_foo_st (void *x_p)
{
  struct foo_st * const x = (struct foo_st *)x_p;
  if (ggc_test_and_set_mark (x))
    {
      gt_ggc_m_9tree_node ((*x).tr);
      gt_ggc_m_8edge_def ((*x).ed);
    }
}

void
gt_pch_nx_foo_st (void *x_p)
{
  struct foo_st * const x = (struct foo_st *)x_p;
  if (gt_pch_note_object (x, x, gt_pch_p_6foo_st, gt_ggc_e_6foo_st))
    {
      gt_pch_n_9tree_node ((*x).tr);
      gt_pch_n_8edge_def ((*x).ed);
    }
}

/* GC roots.  */

const struct ggc_root_tab gt_ggc_r_gt_testgt_h[] = {
  {
    &foo_ptr,
    1,
    sizeof (foo_ptr),
    &gt_ggc_mx_foo_st,
    &gt_pch_nx_foo_st
  },
  LAST_GGC_ROOT_TAB
};
#######################################################

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


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