[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] verify: new macro 'assume'

From: Pádraig Brady
Subject: Re: [PATCH] verify: new macro 'assume'
Date: Fri, 04 Oct 2013 12:05:27 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 10/04/2013 06:59 AM, Paul Eggert wrote:
> On 10/03/13 01:29, Pádraig Brady wrote:
>> Minor point. Would it be more general to use !defined NDEBUG,
>> since this is a runtime operation very similar to assert()
>> and that honors NDEBUG.  Also, I don't suppose assert() is a more
>> portable equivalent of this block?
> I considered using !defined NDEBUG, but that would bloat Emacs when
> configured in the default way, when building with GCC 3.3.4 through
> 4.4.x, as it would cause 'assume' to insert code that makes Emacs
> reliably trap when COND is false, and there's some runtime overhead to
> that.  Since part of the point of 'assume' is to make Emacs go a bit
> faster, doing this would have been a bit counterproductive.

Well it would still give the compiler directions
about what it can assume, and so might generate faster
albeit slightly bigger code.

> This minor point is becoming less important with time, as GCC
> 4.5-or-later will eventually become ubiquitous.

Which might be an argument to take the simplest and most portable
approach from this dwindling case.

>> As a matter of interest what warnings are printed here.
>> Are those warnings dependent on optimization levels?
> Sorry, I don't recall exactly, but they typically have to do
> with range analysis in newer versions of GCC.

I noticed some other notes on assert() vs __builtin_trap() here:

Thanks for the explanation.
Feel free to push whatever approach you think best.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]