Laurynas Biveinis wrote:
> 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?
>
Have to typedef the pointer due to gengtype silliness, IIRC.
IE typedef struct histogram_value_t *histogram_value_t_p;
then use histogram_value_t_p in the structure with the gty marker.