svn commit: r285284 - head/lib/liblzma

NGie Cooper yaneurabeya at gmail.com
Thu Jul 9 09:19:21 UTC 2015


On Thu, Jul 9, 2015 at 1:44 AM, David Chisnall <theraven at freebsd.org> wrote:
> On 9 Jul 2015, at 03:53, NGie Cooper <yaneurabeya at gmail.com> wrote:
>>
>> $ cat ~/has_immintrin.c
>> #include <sys/cdefs.h>
>>
>> #if __has_include(<immintrin.h>)
>> #error "I have immintrin.h"
>> #else
>> #error "I don't have immintrin.h"
>> #endif
>> $ clang -c ~/has_immintrin.c
>> /home/ngie/has_immintrin.c:4:2: error: "I have immintrin.h"
>> #error "I have immintrin.h"
>> ^
>> 1 error generated.
>> $ gcc -c ~/has_immintrin.c
>> /home/ngie/has_immintrin.c:6:2: error: #error "I don't have immintrin.h"
>>
>> Sadly this macro wasn't added until gcc 5.x:
>> https://gcc.gnu.org/gcc-5/changes.html
>
> cdefs.h defines __has_include(x) to 0 if the compiler does not provide __has_include(), so this will also work with gcc in base (always claiming not to have immintrin.h).

Yes, but this case will fail for gcc 4.3 ~ 4.4 through 5.x if you use
my recommended method...


More information about the svn-src-head mailing list