xfs
[Top] [All Lists]

Re: [PATCH] xfsprogs: mark some functions as noreturn

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfsprogs: mark some functions as noreturn
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 4 Sep 2009 19:09:04 -0400
Cc: xfs mailing list <xfs@xxxxxxxxxxx>
In-reply-to: <4AA19639.6090208@xxxxxxxxxxx>
References: <4AA19639.6090208@xxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
On Fri, Sep 04, 2009 at 05:35:37PM -0500, Eric Sandeen wrote:
> Static checkers are a lot less noisy if they know certain
> functions are noreturn.
> 
> Making this change removed about 50 errors from "clang" output.
> (http://clang-analyzer.llvm.org) output.

Not pretty but useful,


Reviewed-by: Christoph Hellwig <hch@xxxxxx>

> -void do_abort(char const *, ...);            /* abort, internal error */
> -void do_error(char const *, ...);            /* abort, system error */
> -void do_warn(char const *, ...);             /* issue warning */
> -void do_log(char const *, ...);              /* issue log message */
> +/* abort, internal error */
> +void  __attribute__((noreturn)) do_abort(char const *, ...);
> +/* abort, system error */
> +void  __attribute__((noreturn)) do_error(char const *, ...);
> +/* issue warning */
> +void do_warn(char const *, ...);
> +/* issue log message */
> +void do_log(char const *, ...);

It would be good to add the proper printflike attributes to these to
also get vararg typechecking.

<Prev in Thread] Current Thread [Next in Thread>