Re: [PATCH 02/40] Eliminate make_cleanup_obstack_free, introduce auto_obstack

Yao Qi
2017-06-28T21:33:17Z

On 17-06-28 15:39:28, Pedro Alves wrote:
>
> A little, but not very seriously. I did name the type as "auto_"
> thinking that that's what GCC folks tend to name their
> container/RAII types.
>
> But OTOH, it feel a bit too early to propose that; it feels like
> we could do more with extending the auto_obstack API; but OTOH I'm

The reason I suggest to "upstream" it is its simplicity, and it doesn't
use any c++ 11 feature.

> not sure whether we'll continue to use obstacks directly that much;
> I suspect that we may end up with allocators instead, thought
> I haven't given that that much thought.

Agreed. The reason I read your patch again is that I want to class-fy
some structures (frame_unwind for example) which are allocated on
obstack.

>
> Also, I think that it couldn't be put in include/obstack.h,
> since the obstack API requires that you define the
> obstack_chunk_alloc/obstack_chunk_free macros (and GCC
> defines those differently from us, which would be recipe
> for ODR violations).
>
> Also, unfortunately GCC is still C++03, and I didn't want to
> paint myself into a corner. :-)
>

No problem, that is fine to keep it in GDB.

--
Yao