aboutsummaryrefslogtreecommitdiffstats
path: root/src/build-data/detect_version.cpp
blob: 55e5db98d52a79444d4ebb3fd0a415b1733be67d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* This file is preprocessed to produce output that is examined by
* configure.py to determine the compilers version number.
*/

#if defined(_MSC_VER)

// _MSC_VER Defined as an integer literal that encodes the major and minor
// number elements of the compiler's version number. The major number is
// the first element of the period-delimited version number and the minor
// number is the second element. For example, if the version number of the
// Visual C++ compiler is 17.00.51106.1, the _MSC_VER macro evaluates to 1700.
// https://msdn.microsoft.com/en-us/library/b0084kay.aspx

MSVC _MSC_VER

#elif defined(__clang__)

#if defined(__apple_build_version__)

/*
Map Apple XCode versions back to standard Clang

This is not a complete map, since we don't support any versions of
Clang before 3.5 in any case, and it arbitrarily maps any version with
XCode >= 9 to Clang 4.0. This is fine because we don't currently need
any features not available in Clang 4.0
*/

#if __clang_major__ >= 9
CLANG 4 0
#elif __clang__major__ == 8
CLANG 3 9
#elif __clang__major__ == 7 && __clang__minor__ == 3
CLANG 3 8
#elif __clang__major__ == 7
CLANG 3 7
#else
CLANG 3 5
#endif

#else

CLANG __clang_major__ __clang_minor__

#endif

#elif defined(__GNUG__)

GCC __GNUC__ __GNUC_MINOR__

#else

UNKNOWN 0 0

#endif