Re: [PATCH 1/2] Annotate internal_error with the attribute noreturn

Subject: Re: [PATCH 1/2] Annotate internal_error with the attribute noreturn

Date: Fri, 21 Sep 2012 17:31:03 -0300

To: Justus Winter, notmuch@notmuchmail.org

Cc:

From: David Bremner


Justus Winter <4winter@informatik.uni-hamburg.de> writes:

> Annotating functions that do not return with the noreturn attribute
> (which is understood by both gcc and clang) prevents static analyzers
> from generating false positives (internal_error is used to terminate
> the process and is used extensively in error handling code paths).
>
> Remove the return statement that was placed there to appease the
> compiler. Functions annotated with noreturn are not supposed to return
> any values.
>

This patch looks OK (although I don't know the pragma details).  Do you
(or anyone) happen to know why _internal_error is an int function?
Making it void wouldn't fix the problem with static analzers, but having
an int function without a return looks ugly to me.

d

Thread: