[patch] Protect generated .h files from multiple inclusion, include tm.h in hooks.h, and FIX BOOTSTRAP

Zack Weinberg zack@codesourcery.com
Thu Jun 19 01:55:00 GMT 2003


Nathanael Nerode <neroden@twcny.rr.com> writes:

> This is a revised version of 
> http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02146.html.
> This version protects *all* generated headers from multiple inclusion.

I think this part of the patch is a good idea independent of what you
needed it for.

> (Could get into problems if the use of 'sed' turns out to be unportable
> in some stupid way, but I doubt that.)

I think y/// is portable, but just to be safe, suggest you use tr instead:

tr_from='abcdefghijklmnopqrstuvwxyz./'
tr_to='ABCDEFGHIJKLMNOPQRSTUVWXYZ__'
header_guard=GCC_`echo "$output" | tr "$tr_from" "$tr_to"`

Note also the inclusion of / in the transliteration set.

> +/* We need the definition of enum reg_class (which is in tm.h)
> +   for hook_reg_class_void_no_regs. */
> +#include "tm.h"
> +
>  bool hook_bool_void_false PARAMS ((void));
>  enum reg_class hook_reg_class_void_no_regs (void);
>  bool hook_bool_bool_false (bool);

Bleah.  I do *not* like the appearance of tm.h in this header.  It is
used in langhooks-def.h, which is clearly front-end and has no
business knowing about register classes.  I realize this isn't your
fault but I would ask that you instead find a more appropriate place
to declare hook_reg_class_void_no_regs.

zw



More information about the Gcc-patches mailing list