Config_msc.h 2.77 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/******************************************************************************
 *
 * AMDiS - Adaptive multidimensional simulations
 *
 * Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
 * Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
 *
 * Authors: 
 * 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.
 * 
 ******************************************************************************/



/** \file Config_msc.h */

25
26
#pragma once

27
#define MSC_VERSION _MSC_VER
28
29
30
31
32
// MSC_VERSION == 1800 (Visual Studio 2013)
// MSC_VERSION == 1700 (Visual Studio 2012)
// MSC_VERSION == 1600 (Visual Studio 2010)
// MSC_VERSION == 1500 (Visual Studio 2008)

33
#define COMPILER_NAME "msc"
34
#define COMPILER_VERSION MSC_VERSION
35
#define COMPILER_IS_MSVC
36
37
38
39
40
41
42
43
44

// alignement specification
// ------------------------
#define ALIGNED(type,name,N)  __declspec(align(CACHE_LINE)) type name[N]
typedef __declspec(align(CACHE_LINE)) double aligned_double;
typedef __declspec(align(CACHE_LINE)) float  aligned_float;
typedef __declspec(align(CACHE_LINE)) int    aligned_int;
typedef __declspec(align(CACHE_LINE)) size_t aligned_size_t;

45
46
47
48
#include <malloc.h>
#define ALIGNED_ALLOC(type,size,alignement) (type*)_aligned_malloc(size,alignement)
#define ALIGNED_FREE(ptr) _aligned_free(ptr);

49
50
51
52
53
54
55
56
// some compiler attributes
// ------------------------
#define NOINLINE         __declspec(noinline)
#define ALWAYS_INLINE    __forceinline
#define OPENMODE         std::ios::open_mode

// C++11 features
// --------------
57
58
59
60
// #if __cplusplus > 199711L
// #ifndef HAS_CXX11
//   #define HAS_CXX11 1
// #endif
61

Praetorius, Simon's avatar
Praetorius, Simon committed
62
#if MSC_VERSION >= 1800 && !defined(HAS_VARIADIC_TEMPLATES)
63
64
65
  #define HAS_VARIADIC_TEMPLATES 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
66
#if MSC_VERSION >= 1800 && !defined(HAS_ALIAS_TEMPLATES)
67
68
69
  #define HAS_ALIAS_TEMPLATES 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
70
#if MSC_VERSION >= 1600 && !defined(HAS_DECLTYPE)
71
72
73
74
  #define HAS_DECLTYPE 1
#endif

// #if MSC_VERSION >= 2000 (?)
Praetorius, Simon's avatar
Praetorius, Simon committed
75
#if !defined(HAS_CONSTEXPR)
76
#define HAS_CONSTEXPR 0
Praetorius, Simon's avatar
Praetorius, Simon committed
77
#endif
78

Praetorius, Simon's avatar
Praetorius, Simon committed
79
#if MSC_VERSION >= 1800 && !defined(HAS_DELEGATING_CONSTRUCTORS)
80
81
82
  #define HAS_DELEGATING_CONSTRUCTORS 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
83
#if MSC_VERSION >= 1700 && !defined(HAS_RANGE_BASED_FOR)
84
85
86
  #define HAS_RANGE_BASED_FOR 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
87
#if MSC_VERSION >= 1800 && !defined(HAS_INITIALIZER_LISTS)
88
89
90
  #define HAS_INITIALIZER_LISTS 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
91
#if MSC_VERSION >= 1700 && !defined(HAS_OVERRIDE)
92
93
94
  #define HAS_OVERRIDE 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
95
#if MSC_VERSION >= 1700 && !defined(HAS_TYPED_ENUMS)
96
97
98
  #define HAS_TYPED_ENUMS 1
#endif

Praetorius, Simon's avatar
Praetorius, Simon committed
99
#if MSC_VERSION >= 1600 && !defined(HAS_RVALUE_REFERENCES)
100
101
102
  #define HAS_RVALUE_REFERENCES 1
#endif

103
// #endif