This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: identifier GC
On Mon, Mar 24, 2008 at 6:09 PM, Tom Tromey <tromey@redhat.com> wrote:
> >>>>> "Richard" == Richard Guenther <richard.guenther@gmail.com> writes:
>
>
> >> * There was some code assuming that the result of ggc_alloc_string
> >> (or ggc_strdup) was uncollectable.
>
> Richard> IMHO this should go in separately.
>
> Here's the patch. Bootstrapped and regtested on the compile farm.
> Ok?
It looks obvious to me (I'm not a C++ maintainer, but CCed one).
Thanks,
Richard.
> Tom
>
> gcc/cp/ChangeLog:
> 2008-03-24 Tom Tromey <tromey@redhat.com>
>
> * lex.c (handle_pragma_interface): Don't copy the filename.
>
> (handle_pragma_implementation): Copy filename using xstrdup.
>
>
> Index: gcc/cp/lex.c
> ===================================================================
> --- gcc/cp/lex.c (revision 133392)
> +++ gcc/cp/lex.c (working copy)
> @@ -518,7 +518,7 @@
>
> else if (fname == 0)
> filename = lbasename (input_filename);
> else
> - filename = ggc_strdup (TREE_STRING_POINTER (fname));
> + filename = TREE_STRING_POINTER (fname);
>
> finfo = get_fileinfo (input_filename);
>
> @@ -566,7 +566,7 @@
>
> }
> else
> {
> - filename = ggc_strdup (TREE_STRING_POINTER (fname));
> + filename = TREE_STRING_POINTER (fname);
> if (cpp_included_before (parse_in, filename, input_location))
> warning (0, "#pragma implementation for %qs appears after "
> "file is included", filename);
> @@ -580,7 +580,7 @@
>
>
> if (ifiles == 0)
> {
> ifiles = XNEW (struct impl_files);
> - ifiles->filename = filename;
> + ifiles->filename = xstrdup (filename);
> ifiles->next = impl_file_chain;
> impl_file_chain = ifiles;
> }
>