On 23 November 2017 at 22:08, Paolo Bonzini <pbonz...@redhat.com> wrote: > On 22/11/2017 13:14, Peter Maydell wrote: >>> 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. > > There's plenty of cases where "if (kvm_enabled())" code would fail to > link if the compiler didn't do that optimization.
I think that's a step less weird than "assert(kvm_enabled())", but I tend to think of that kind of thing as "if the compiler ever did decide not to link it we'd add missing stub functions". thanks -- PMM