Config_msc.h 2.73 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
35
36
37
38
39
40
41
42
43
#define COMPILER_VERSION MSC_VERSION

// 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;

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

48
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
// --------------
#if __cplusplus > 199711L
Praetorius, Simon's avatar
Praetorius, Simon committed
57
58
59
#ifndef HAS_CXX11
  #define HAS_CXX11 1
#endif
60

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

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

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

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

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

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

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

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

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

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

102
#endif