Config_clang.h 2.66 KB
Newer Older
1
2
3
4
5
6
7
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
8
 * Authors:
9
10
11
12
13
14
15
16
17
 * Simon Vey, Thomas Witkowski, Andreas Naumann, Simon Praetorius, et al.
 *
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * This file is part of AMDiS
 *
 * See also license.opensource.txt in the distribution.
18
 *
19
20
21
22
23
24
 ******************************************************************************/



/** \file Config_clang.h */

25
26
27
#pragma once

#define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
28
29
30

#define COMPILER_NAME "clang"
#define COMPILER_VERSION CLANG_VERSION
31
32
33
34

// alignement specification
// ------------------------
#define ALIGNED(type,name,N)  type name[N] __attribute__ ((aligned(CACHE_LINE)))
35
36
#define ASSUME_ALIGNED(var)   __builtin_assume_aligned(var, CACHE_LINE)

37
38
39
40
41
42
43
44
45
46
47
48
49
typedef double aligned_double   __attribute__ ((aligned(CACHE_LINE)));
typedef float  aligned_float    __attribute__ ((aligned(CACHE_LINE)));
typedef int    aligned_int      __attribute__ ((aligned(CACHE_LINE)));
typedef size_t aligned_size_t   __attribute__ ((aligned(CACHE_LINE)));

// some compiler attributes
// ------------------------
#define NOINLINE                __attribute__ ((noinline))
#define ALWAYS_INLINE           __attribute__ ((always_inline))
#define OPENMODE                std::ios::openmode

// C++11 features
// --------------
50
#if AMDIS_HAS_CXX11
51

52
// __has_feature(cxx_rvalue_references)
Praetorius, Simon's avatar
Praetorius, Simon committed
53
#if CLANG_VERSION >= 20900 && !defined(HAS_VARIADIC_TEMPLATES)
54
55
56
  #define HAS_VARIADIC_TEMPLATES 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
57
#if CLANG_VERSION >= 30000 && !defined(HAS_ALIAS_TEMPLATES)
58
59
60
  #define HAS_ALIAS_TEMPLATES 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
61
#if CLANG_VERSION >= 20900 && !defined(HAS_DECLTYPE)
62
63
64
  #define HAS_DECLTYPE 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
65
#if CLANG_VERSION >= 30100 && !defined(HAS_CONSTEXPR)
66
67
68
  #define HAS_CONSTEXPR 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
69
#if CLANG_VERSION >= 30000 && !defined(HAS_DELEGATING_CONSTRUCTORS)
70
71
72
  #define HAS_DELEGATING_CONSTRUCTORS 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
73
#if CLANG_VERSION >= 30000 && !defined(HAS_RANGE_BASED_FOR)
74
75
76
  #define HAS_RANGE_BASED_FOR 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
77
#if CLANG_VERSION >= 30100 && !defined(HAS_INITIALIZER_LISTS)
78
79
80
  #define HAS_INITIALIZER_LISTS 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
81
#if CLANG_VERSION >= 30000 && !defined(HAS_OVERRIDE)
82
83
84
  #define HAS_OVERRIDE 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
85
#if CLANG_VERSION >= 20900 && !defined(HAS_TYPED_ENUMS)
86
87
88
  #define HAS_TYPED_ENUMS 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
89
#if CLANG_VERSION >= 20900 && !defined(HAS_RVALUE_REFERENCES)
90
91
92
  #define HAS_RVALUE_REFERENCES 1
#endif

93
#endif