This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to GTYize a struct properly?
- From: "Laurynas Biveinis" <laurynas dot biveinis at gmail dot com>
- To: "GCC Mailing List" <gcc at gcc dot gnu dot org>
- Cc: "Daniel Berlin" <dberlin at dberlin dot org>
- Date: Sun, 13 Aug 2006 21:40:46 +0300
- Subject: How to GTYize a struct properly?
Hi,
For typed GC allocation I've to add GTY markers for a few datatypes.
An example from value-prof.h:
Before:
struct histogram_value_t
{
struct
{ /* <--- line 48, error below occurs here */
tree value; /* The value to profile. */
tree stmt; /* Insn containing the value. */
gcov_type *counters; /* Pointer to first counter. */
struct histogram_value_t *next; /* Linked list pointer. */
} hvalue;
enum hist_type type; /* Type of information to measure. */
unsigned n_counters; /* Number of required counters. */
union
{
struct
{
int int_start; /* First value in interval. */
unsigned int steps; /* Number of values in it. */
} intvl; /* Interval histogram data. */
} hdata; /* Profiled information specific data. */
};
After my best effor so far:
struct histogram_value_t GTY(())
{
struct
{ /* <--- line 48, error below occurs here */
tree value; /* The value to profile. */
tree stmt; /* Insn containing the value. */
gcov_type *counters; /* Pointer to first counter. */
struct histogram_value_t GTY((chain_next("%h.next")) *next; /*
Linked list pointer. */
} hvalue;
enum hist_type type; /* Type of information to measure. */
unsigned n_counters; /* Number of required counters. */
union
{
struct
{
int int_start; /* First value in interval. */
unsigned int steps; /* Number of values in it. */
} intvl; /* Interval histogram data. */
} GTY ((default("intvl")) hdata; /* Profiled information specific data. */
};
And this one gives a gengtype error:
../../gcc-boehm-custom-marking/gcc/value-prof.h:48: syntax error,
unexpected '*', expecting ')'
What should I do about it?
--
Laurynas