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: http://lists.gnu.org/archive/html/bug-gnulib/2011-05/threads.html#00205 Thanks for the explanation. Feel free to push whatever approach you think best. Pádraig.