https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115735

--- Comment #15 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
(In reply to Gabriel Ravier from comment #14)
> __attribute((async_signal_unsafe)) certainly seems quite useful (that is,
> like many attributes it avoids having to rely on massive cross-TU analysis
> for something we'd want to be able to do without -flto), but I do wonder
> whether __attribute((async_signal_safe)) would be equally or more useful
> (IMO I'd think so - it would seem to be like it'd be more common to want
> that as a way to ensure one is writing a signal handler that one can know
> does *not* call an unsafe function according to the attributes, if one of
> the two should be chosen over the over I'd take `async_signal_safe` any day
> of the week, though I wouldn't be against having both either, if e.g. having
> a specific toggle-able warning option for "function not marked either of
> these is called" seems useful)

I agree, async_signal_safe is likely more useful, given that there's only a
specific set of library functions that are considered signal-handler-safe. 
However the trouble is that it would require annotations across whatever
codebase is being analyzed, which could be painful for adoption.  But none of
those are blocking issues.

Reply via email to