On Wed, 28 Jun 2023 at 08:56, Jan Hubicka <hubi...@ucw.cz> wrote:
>
> > I think the __throw_bad_alloc() and __throw_bad_array_new_length()
> > functions should always be rare, so marking them cold seems fine (users who
> > define their own allocators that want to throw bad_alloc "often" will
> > probably throw it directly, they shouldn't be using our __throw_bad_alloc()
> > function anyway). I don't think __throw_bad_exception is ever used, so that
> > doesn't matter (we could remove it from the header and just keep its
> > definition in the library, but there's no big advantage to doing that).
> > Others like __throw_length_error() should also be very very rare, and could
> > be marked cold.
> >
> > Maybe we should just mark everything in <bits/functexcept.h> as cold. If
> > users want to avoid the cost of calls to those functions they can do so by
> > checking function preconditions/arguments to avoid the exceptions. There
> > are very few places where a throwing libstdc++ API doesn't have a way to
> > avoid the exception. The only one that isn't easily avoidable is
> > __throw_bad_alloc but OOM should be rare.
>
> Hi,
> this marks everything in functexcept.h as cold and I also noticed that
> we probably want to mark as such terminate.

Should we do the same for __glibcxx_assert_fail, declared in
libstdc++-v3/include/bits/c++config?

Reply via email to