carl  24.04
Computer ARithmetic Library
platform.h
Go to the documentation of this file.
1 /**
2  * @file: platform.h
3  * @author: Gereon Kremer <gereon.kremer@cs.rwth-aachen.de>
4  *
5  * This file contains platform and compiler specific macros.
6  */
7 
8 #pragma once
9 
10 //////////////////////
11 // Compiler identification
12 // taken from http://sourceforge.net/p/predef/wiki/Compilers/
13 
14 #define STRINGIFY(s) #s
15 
16 #if defined __clang__
17  #define __CLANG
18 
19  #define CLANG_WARNING_DISABLE(warning)\
20  _Pragma("clang diagnostic push")\
21  _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")\
22  _Pragma("clang diagnostic ignored \"-Wunknown-warning-option\"")\
23  _Pragma( STRINGIFY(clang diagnostic ignored warning) )
24  #define CLANG_WARNING_RESET\
25  _Pragma("clang diagnostic pop")
26 #elif defined __GNUC__
27  #define __GCC
28 
29  #define CLANG_WARNING_DISABLE(warning)
30  #define CLANG_WARNING_RESET
31 #elif defined _MSC_VER
32  #define __VS
33 
34  #define CLANG_WARNING_DISABLE(warning)
35  #define CLANG_WARNING_RESET
36 #else
37  #warning "You are using an unsupported compiler."
38  #define __UNSUPPORTED
39 #endif
40 
41 #if defined _WIN32
42  #define __WIN
43 #elif defined _WIN64
44  #define __WIN
45 #elif defined __APPLE__
46  #define __MACOS
47 #elif defined __linux__
48  #define __LINUX
49 #else
50  #warning "You are using an unsupported operating system."
51 #endif