Project Alice
Loading...
Searching...
No Matches
clangfeatures.h
Go to the documentation of this file.
1/*
2Copyright 2010-2016, D. E. Shaw Research.
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9* Redistributions of source code must retain the above copyright
10 notice, this list of conditions, and the following disclaimer.
11
12* Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions, and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15
16* Neither the name of D. E. Shaw Research nor the names of its
17 contributors may be used to endorse or promote products derived from
18 this software without specific prior written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*/
32#ifndef __clangfeatures_dot_hpp
33#define __clangfeatures_dot_hpp
34
35#ifndef R123_USE_X86INTRIN_H
36#if(defined(__x86_64__) || defined(__i386__))
37#define R123_USE_X86INTRIN_H 1
38#else
39#define R123_USE_X86INTRIN_H 0
40#endif
41#endif
42
43#ifndef R123_USE_CXX11_UNRESTRICTED_UNIONS
44#define R123_USE_CXX11_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions)
45#endif
46
47#ifndef R123_USE_CXX11_STATIC_ASSERT
48#define R123_USE_CXX11_STATIC_ASSERT __has_feature(cxx_static_assert)
49#endif
50
51// With clang-3.6, -Wall warns about unused-local-typedefs.
52// The "obvious" thing to do is to ignore -Wunused-local-typedefs,
53// but that doesn't work because earlier versions of clang blow
54// up on an 'unknown warning group'. So we briefly ignore -Wall...
55// It's tempting to just give up on static assertions in pre-c++11 code.
56#if !R123_USE_CXX11_STATIC_ASSERT && !defined(R123_STATIC_ASSERT)
57#define R123_STATIC_ASSERT(expr, msg) _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wall\"") typedef char static_assertion[(!!(expr)) * 2 - 1] _Pragma("clang diagnostic pop")
58#endif
59
60#ifndef R123_USE_CXX11_CONSTEXPR
61#define R123_USE_CXX11_CONSTEXPR __has_feature(cxx_constexpr)
62#endif
63
64#ifndef R123_USE_CXX11_EXPLICIT_CONVERSIONS
65#define R123_USE_CXX11_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions)
66#endif
67
68// With clang-3.0, the apparently simpler:
69// #define R123_USE_CXX11_RANDOM __has_include(<random>)
70// dumps core.
71#ifndef R123_USE_CXX11_RANDOM
72#if __cplusplus >= 201103L && __has_include(<random>)
73#define R123_USE_CXX11_RANDOM 1
74#else
75#define R123_USE_CXX11_RANDOM 0
76#endif
77#endif
78
79#ifndef R123_USE_CXX11_TYPE_TRAITS
80#if __cplusplus >= 201103L && __has_include(<type_traits>)
81#define R123_USE_CXX11_TYPE_TRAITS 1
82#else
83#define R123_USE_CXX11_TYPE_TRAITS 0
84#endif
85#endif
86
87#include "gccfeatures.h"
88
89#endif