[cfe-commits] [PATCH] Suppress -Wunused-value for explicit casts in macros

David Blaikie dblaikie at gmail.com
Tue Oct 23 16:19:31 PDT 2012


On Tue, Oct 23, 2012 at 1:48 PM, Matt Beaumont-Gay <matthewbg at google.com> wrote:
> The motivating case here is that OpenSSL has some code like this:
>
> static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr);
> ...
> #define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
>
> That cast to int causes client code which calls BIO_flush and ignores
> the result to get a -Wunused-value warning.

LGTM.

(I don't suppose there's any way to narrow this down to ensure it's
logically at the outer most scope of the macro?)



More information about the cfe-commits mailing list