[RFC] analyzer: Add exit, and _exit replacement, to sm-signal.

Mark Wielaard mark@klomp.org
Wed May 20 22:48:53 GMT 2020


Hi,

On Mon, May 18, 2020 at 07:30:58PM -0400, Marek Polacek wrote:
> > +  /* Returns a replacement function as text if it exists.  Currently
> > +     only "exit" has a signal-safe replacement "_exit", which does
> > +     slightly less, but can be used in a signal handler.  */
> > +  const char *
> > +  get_replacement_fn ()
> > +  {
> > +    gcc_assert (m_unsafe_fndecl && DECL_P (m_unsafe_fndecl));
> > +
> > +    if (strcmp ("exit",
> > +		IDENTIFIER_POINTER (DECL_NAME (m_unsafe_fndecl))) == 0)
> 
> Instead of strcmp, you should be able to use id_equal here, making this a bit
> simpler.

That does make it a little easier to read.
How about the attached?

Thanks,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-analyzer-Add-exit-and-_exit-replacement-to-sm-signal.patch
Type: text/x-diff
Size: 4146 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200521/638d2925/attachment.bin>


More information about the Gcc-patches mailing list