[PATCH v3] Introduce gdb::unique_ptr

Tom Tromey tom@tromey.com
Sun Oct 16 07:14:00 GMT 2016


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> For managing malloc pointers, this adds a gdb::unique_malloc_ptr<T>
Pedro> "specialization" with a custom xfree deleter.

I found something surprising while using this patch: it can't be used in
a .y file, due to the malloc->xmalloc renaming done in the .y.c rule.
I puzzled over the error about "unique_xmalloc_ptr" for a while until I
remembered this.

One option would be to fix up that renaming, maybe something like:

-	     -e 's/\([^x]\)malloc/\1xmalloc/g' \
-	     -e 's/\([^x_]\)malloc/\1xmalloc/g' \

Another would be to rename the class unique_xmalloc_ptr after all.

Tom



More information about the Gdb-patches mailing list