From: Johannes Sixt <j6t@kdbg.org>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC 0/3] compiling git with gcc -O3 -Wuninitialized
Date: Sat, 15 Dec 2012 11:49:25 +0100 [thread overview]
Message-ID: <50CC55B5.8000205@kdbg.org> (raw)
In-Reply-To: <20121214220903.GA18418@sigill.intra.peff.net>
Am 14.12.2012 23:09, schrieb Jeff King:
> Can anybody think of a clever way to expose the constant return value of
> error() to the compiler? We could do it with a macro, but that is also
> out for error(), as we do not assume the compiler has variadic macros. I
> guess we could hide it behind "#ifdef __GNUC__", since it is after all
> only there to give gcc's analyzer more information. But I'm not sure
> there is a way to make a macro that is syntactically identical. I.e.,
> you cannot just replace "error(...)" in "return error(...);" with a
> function call plus a value for the return statement. You'd need
> something more like:
>
> #define RETURN_ERROR(fmt, ...) \
> do { \
> error(fmt, __VA_ARGS__); \
> return -1; \
> } while(0) \
>
> which is awfully ugly.
Does
#define error(fmt, ...) (error_impl(fmt, __VA_ARGS__), -1)
cause problems when not used in a return statement?
-- Hannes
next prev parent reply other threads:[~2012-12-15 10:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 22:09 [PATCH/RFC 0/3] compiling git with gcc -O3 -Wuninitialized Jeff King
2012-12-14 22:11 ` [PATCH 1/3] remote-testsvn: fix unitialized variable Jeff King
2012-12-15 10:29 ` Florian Achleitner
2012-12-14 22:12 ` [PATCH/RFC 2/3] inline error functions with constant returns Jeff King
2012-12-14 22:13 ` [PATCH/RFC 3/3] silence some -Wuninitialized warnings around errors Jeff King
2012-12-15 3:07 ` [PATCH/RFC 0/3] compiling git with gcc -O3 -Wuninitialized Nguyen Thai Ngoc Duy
2012-12-15 10:09 ` Jeff King
2012-12-15 10:49 ` Johannes Sixt [this message]
2012-12-15 11:09 ` Jeff King
2012-12-15 17:36 ` [PATCH/RFCv2 0/2] " Jeff King
2012-12-15 17:37 ` [PATCH 1/2] make error()'s constant return value more visible Jeff King
2012-12-15 17:42 ` [PATCH 2/2] silence some -Wuninitialized false positives Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50CC55B5.8000205@kdbg.org \
--to=j6t@kdbg.org \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.