Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jul 2015 09:44:03 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        NGie Cooper <yaneurabeya@gmail.com>
Cc:        Dimitry Andric <dim@freebsd.org>, Adrian Chadd <adrian.chadd@gmail.com>, Pedro Giffuni <pfg@freebsd.org>, Luigi Rizzo <luigi@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r285284 - head/lib/liblzma
Message-ID:  <E1605BA4-DBE6-4F7B-BC5E-15E78671DF9B@FreeBSD.org>
In-Reply-To: <CAGHfRMA%2BpybAf=snW_NdjyQ0Amnw%2Bz2aGEp8_F-eVKy9eqGRzg@mail.gmail.com>
References:  <201507081836.t68IacJu069563@repo.freebsd.org> <559D9172.9040305@FreeBSD.org> <CAJ-Vmo=m0Y%2BE0oi5ec5RzyziqObOj=fKY1K-8HzqK8x7D_TcKg@mail.gmail.com> <F5CD87E5-92B5-4E87-8DAF-18F4510CD113@FreeBSD.org> <CAGHfRMA%2BpybAf=snW_NdjyQ0Amnw%2Bz2aGEp8_F-eVKy9eqGRzg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9 Jul 2015, at 03:53, NGie Cooper <yaneurabeya@gmail.com> wrote:
>=20
> $ cat ~/has_immintrin.c
> #include <sys/cdefs.h>
>=20
> #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"
>=20
> 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).

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1605BA4-DBE6-4F7B-BC5E-15E78671DF9B>