From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Kyle J. McKay" <mackyle@gmail.com>
Cc: Jonathan Tan <jonathantanmy@google.com>,
Junio C Hamano <gitster@pobox.com>,
Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH] mailinfo.c: move side-effects outside of assert
Date: Mon, 19 Dec 2016 18:45:40 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1612191844520.54750@virtualbox> (raw)
In-Reply-To: <900a55073f78a9f19daca67e468d334@3c843fe6ba8f3c586a21345a2783aa0>
Hi,
On Sat, 17 Dec 2016, Kyle J. McKay wrote:
> Since 6b4b013f18 (mailinfo: handle in-body header continuations,
> 2016-09-20, v2.11.0) mailinfo.c has contained new code with an
> assert of the form:
>
> assert(call_a_function(...))
>
> The function in question, check_header, has side effects. This
> means that when NDEBUG is defined during a release build the
> function call is omitted entirely, the side effects do not
> take place and tests (fortunately) start failing.
>
> Move the function call outside of the assert and assert on
> the result of the function call instead so that the code
> still works properly in a release build and passes the tests.
>
> Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
ACK. I noticed this problem (and fixed it independently as a part of a
huge patch series I did not get around to submit yet) while trying to get
Git to build correctly with Visual C.
Ciao,
Dscho
next prev parent reply other threads:[~2016-12-19 17:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-17 19:54 [PATCH] mailinfo.c: move side-effects outside of assert Kyle J. McKay
2016-12-19 17:45 ` Johannes Schindelin [this message]
2016-12-19 20:03 ` Jeff King
2016-12-19 20:38 ` Kyle J. McKay
2016-12-19 20:54 ` Jonathan Tan
2016-12-19 21:01 ` Junio C Hamano
2016-12-19 23:13 ` [PATCH v2] " Kyle J. McKay
2016-12-19 23:26 ` Junio C Hamano
2016-12-19 23:54 ` [PATCH v3] " Kyle J. McKay
2016-12-20 14:12 ` [PATCH] " Johannes Schindelin
2016-12-20 16:45 ` Jeff King
2016-12-21 5:54 ` Kyle J. McKay
2016-12-21 15:55 ` Jeff King
2016-12-22 2:21 ` Kyle J. McKay
2016-12-22 3:34 ` Jeff King
2016-12-22 17:57 ` Junio C Hamano
2016-12-22 3:53 ` Kyle J. McKay
2016-12-22 3:59 ` 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=alpine.DEB.2.20.1612191844520.54750@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=mackyle@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).