On Mon, May 12, 2014 at 11:44:26AM -0700, Jonathan Nieder wrote:
> > --- a/git-compat-util.h
> > +++ b/git-compat-util.h
> > @@ -331,7 +331,11 @@ extern void warning(const char *err, ...)
> > __attribute__((format (printf, 1, 2)))
> > * using the function as usual.
> > */
> > #if defined(__G
Hi,
Jeff King wrote:
> On Mon, May 05, 2014 at 05:29:38PM -0400, Jeff King wrote:
>> I cannot think of any other way to make the compiler aware of the
>> constant value, but perhaps somebody else is more clever than I am.
>
> This came to me in a dream, and seems to work.
Clever. :) Thanks for
On Sun, May 11, 2014 at 10:22:03AM -0700, Junio C Hamano wrote:
> The alternative you mentioned up-thread "... to write out "return
> error(...)" as "error(...); return -1". In some ways that is more
> readable, though it is more verbose..." has one more downside you
> did not mention, and the ap
Jeff King writes:
> On Tue, May 06, 2014 at 03:29:37PM -0700, Junio C Hamano wrote:
>
>> That's kind of W*A*T magic, and I generally try to avoid magic, as
>> long as it solves your "can we make both -O2 with new compilers and
>> -O3 happy?" I wouldn't complain ;-)
>
> I agree it's rather magical
Junio C Hamano wrote:
> That's kind of W*A*T magic, and I generally try to avoid magic, as
> long as it solves your "can we make both -O2 with new compilers and
> -O3 happy?" I wouldn't complain ;-)
In case anybody is looking for a non-hacky way of doing this that
doesn't depend on the gcc version
On Tue, May 06, 2014 at 03:29:37PM -0700, Junio C Hamano wrote:
> > We can work around this by encapsulating the constant return
> > value in a static inline function, as gcc specifically
> > avoids complaining about unused function returns unless the
> > function has been specifically marked with
Jeff King writes:
> Commit e208f9c introduced a macro to turn error() calls
> into:
>
> (error(), -1)
>
> to make the constant return value more visible to the
> calling code (and thus let the compiler make better
> decisions about the code).
>
> This works well for code like:
>
> return erro
Commit e208f9c introduced a macro to turn error() calls
into:
(error(), -1)
to make the constant return value more visible to the
calling code (and thus let the compiler make better
decisions about the code).
This works well for code like:
return error(...);
but the "-1" is superfluous in
8 matches
Mail list logo