Patch to const-ify tree_code_{type,name,length}

Zack Weinberg zack@codesourcery.com
Tue Jan 1 11:18:00 GMT 2002


On Mon, Dec 24, 2001 at 01:42:05PM -0500, Kaveh R. Ghazi wrote:
> Currently, the arrays for tree_code_type, tree_code_name and
> tree_code_length are mutable arrays of fixed size [256].  They are
> first initialized in tree.c and any language specific tree codes are
> set via memcpy separately in each frontend.
> 
> I noticed we could initialize these at compile time by moving the
> array definition to each particular frontend.  In addition to living
> in .rodata, the arrays would only be as large as they need, not
> artificially taking up 256 elements.

I like this patch, but I have one question:

> +const char tree_code_type[] = {
> +#include "tree.def"
> +  'x',
> +#include "c-common.def"
> +};

Why are we wasting code numbers by inserting gaps between .def files?
We're in danger of running out already. (I realize you didn't add
this.)

zw



More information about the Gcc-patches mailing list