File cpp-fix-gcc4.diff of Package compat-g77
This fixes the preprocessor, when compiling gcc 3.3.x with 4.0 and upwards.
It doesn't properly copy the whole union, and 4.0 indeed doesn't copy the
padding (3.3 did). So if a different field from the union is in use, e.g.
the 'node' member, then it will be copied over only partly on some machines,
leading to very interesting failures because the preprocessor fiddles together
wrong tokens.
--- gcc/cppmacro.c 2003-06-19 07:40:29.000000000 +0200
+++ gcc/cppmacro.c 2005-08-19 05:17:58.328278832 +0200
@@ -921,7 +922,7 @@ replace_args (pfile, node, macro, args)
{
cpp_token *token = _cpp_temp_token (pfile);
token->type = (*paste_flag)->type;
- token->val.str = (*paste_flag)->val.str;
+ token->val = (*paste_flag)->val;
if (src->flags & PASTE_LEFT)
token->flags = (*paste_flag)->flags | PASTE_LEFT;
else
@@ -1170,7 +1170,7 @@ cpp_get_token (pfile)
cpp_token *t = _cpp_temp_token (pfile);
t->type = result->type;
t->flags = result->flags | NO_EXPAND;
- t->val.str = result->val.str;
+ t->val = result->val;
result = t;
}