bug-gnulib
[Top][All Lists]
Advanced

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

Re: more macOS Clang assume warnings


From: Bruno Haible
Subject: Re: more macOS Clang assume warnings
Date: Wed, 26 Aug 2020 03:22:52 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

[Dropping emacs-devel from CC]

Hi Paul,

> So we're adding all this complexity just for a minor performance tweak for an 
> old Clang version? Seems overkill.

"all this complexity" is a 5-lines macro definition for C, and a similar one
for C++. To me, that's not a big complexity. <tgmath.h> for example is way
more complex.

It took me 4 iterations to arrive at the current definition because there was
no test suite that contained the hairy cases that the macro should cover.
With the unit tests that I added today, porting to other compilers will be
simpler.

> Even if we keep this stuff, a comment should mention that it's just for Clang 
> 8 
> (or is it Clang 8 and earlier?).

I had mentioned it in [1], and there is already a comment that explains it:

  /* Use __builtin_assume in preference to __builtin_unreachable, because
     in clang versions 8.0.x and older, the definition based on
     __builtin_assume has an effect on optimizations, whereas the definition
     based on __builtin_unreachable does not.  (GCC so far has only
     __builtin_unreachable.)  */

Bruno

[1] https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00047.html




reply via email to

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