[patch preprocessor]: PR/45362 Dangling reference

Kai Tietz ktietz70@googlemail.com
Thu Sep 23 19:10:00 GMT 2010


2010/9/23 Tom Tromey <tromey@redhat.com>:
>>>>>> "Kai" == Kai Tietz <ktietz70@googlemail.com> writes:
>
> Kai> So here is extended patch storing additional fields location, syshdr,
> Kai> and used of cpp_macro. The pch testsuite is just running. I'll give
> Kai> final result when test is done.
>
> Thanks.
>
> Kai> +  if (node->type == NT_VOID)
> Kai> +    defnlen = 0;
>
> It seems like this could be a flag on the saved macro struct, instead of
> a magic length.

Well, we need still the zero-length store for marking undef-state, but
I added this flag to internal saved structure and avoid allocation of
definition member in such cases.

> Kai> +  _cpp_clean_line (pfile);
> Kai> +  if (!_cpp_create_definition (pfile, h))
> Kai> +    abort ();
> Kai> +  _cpp_pop_buffer (pfile);
> Kai> +      }
> Kai> +    else
> Kai> +      abort ();
> Kai> +    h->value.macro->line = c->line;
> Kai> +    h->value.macro->syshdr = c->syshdr;
> Kai> +    h->value.macro->used = c->used;
>
> I suspect you want to set the 'sysp' flag on the buffer before calling
> _cpp_create_definition.  That may suppress some messages coming from
> _cpp_create_definition.

Yes, I add this sysp setting. This could otherwise leads to unwanted
failure messages.

> Also I wonder if this will have negative side effects on the current
> line as recorded in the cpp reader.

Well, not sure here. At least I didn't noticed here issues.

> In other respects this looks good to me.
>
> Tom
>

Tested for x86_64-w64-mingw32 and i686-w64-mingw32. Ok for apply to 4.6?

Regards,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixdangle.diff
Type: application/octet-stream
Size: 9852 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100923/6e51d8a0/attachment.obj>


More information about the Gcc-patches mailing list