All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Juan Quintela <quintela@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Laurent Vivier <lvivier@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Peter Xu <peterx@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] tcg: Fix complilation with TCG
Date: Wed, 22 Nov 2017 12:14:49 +0000	[thread overview]
Message-ID: <CAFEAcA9zwnY5+=Em2gta7HVoKGv2EBS3UVH+zbwCzOCovyUVdg@mail.gmail.com> (raw)
In-Reply-To: <e384f727-0cdd-9fcd-a50f-a9f89ae2272a@linaro.org>

On 22 November 2017 at 12:08, Richard Henderson
<richard.henderson@linaro.org> wrote:
> On 11/22/2017 01:03 PM, Peter Maydell wrote:
>> Wow, I totally do not expect "assert(tcg_enabled())" to mean
>> "we rely on the compiler to be able to determine that this
>> code is dead" (and in general I'm not a fan of the compilation
>> relying on the compiler determining that code is dead).
>
> We do this all of the time for more regular tests that are obviously
> compile-time.  I am a really big fan of this, because it makes sure that the
> (usually 32-bit) else branch continues to compile.

I'm happy with code that is "we assume the compiler is going to
be sensible here so we don't have to use #ifdefs in the name
of performance". I just don't think we should write code that
can't compile at all if the compiler happens to not identify
the codepath as dead. There's no guarantee by the compiler
that it's going to do that.

Also, if we do have some need to do this, assert() is the
wrong way to do it -- the program should behave (and build)
identically if you strip all the assert()s out of it.
We should have some construct that makes the intent clear.

thanks
-- PMM

  reply	other threads:[~2017-11-22 12:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  8:41 [Qemu-devel] [PATCH] tcg: Fix complilation with TCG Juan Quintela
2017-11-22  9:09 ` no-reply
2017-11-22 12:01 ` Richard Henderson
2017-11-22 12:03   ` Peter Maydell
2017-11-22 12:08     ` Richard Henderson
2017-11-22 12:14       ` Peter Maydell [this message]
2017-11-23 22:08         ` Paolo Bonzini
2017-11-24 10:07           ` Peter Maydell
2017-11-24 10:09             ` Paolo Bonzini
2017-11-22 12:19       ` Dr. David Alan Gilbert
2017-11-22 12:01 ` Peter Maydell
2017-11-22 12:05   ` Juan Quintela
2017-11-22 12:32 ` Philippe Mathieu-Daudé
2017-11-22 22:45   ` Emilio G. Cota
2017-11-23 10:46 ` Peter Maydell

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='CAFEAcA9zwnY5+=Em2gta7HVoKGv2EBS3UVH+zbwCzOCovyUVdg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=richard.henderson@linaro.org \
    /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.