source: pacpusframework/trunk/include/Pacpus/predef/compiler.h@ 324

Last change on this file since 324 was 298, checked in by Marek Kurdej, 11 years ago

Added: operating system and compiler identification macros.

File size: 2.6 KB
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5/// @file
6/// @author Marek Kurdej <firstname.surname@utc.fr>
7/// @date 2014-04-07 10:36:35
8/// @version $Id$
9/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
10/// @brief Brief description.
11///
12/// Detailed description.
13
14#ifndef PACPUS_PREDEF_COMPILER_H
15#define PACPUS_PREDEF_COMPILER_H
16
17#include <Pacpus/predef/version_number.h>
18
19////////////////////////////////////////////////////////////////////////////////
20
21#define PACPUS_COMP_MSVC PACPUS_VERSION_NUMBER_NOT_AVAILABLE
22
23#if defined(_MSC_VER)
24# undef PACPUS_COMP_MSVC
25# if !defined (_MSC_FULL_VER)
26# define PACPUS_COMP_MSVC_BUILD 0
27# else
28 /* how many digits does the build number have? */
29# if _MSC_FULL_VER / 10000 == _MSC_VER
30 /* four digits */
31# define PACPUS_COMP_MSVC_BUILD (_MSC_FULL_VER % 10000)
32# elif _MSC_FULL_VER / 100000 == _MSC_VER
33 /* five digits */
34# define PACPUS_COMP_MSVC_BUILD (_MSC_FULL_VER % 100000)
35# else
36# error "Cannot determine build number from _MSC_FULL_VER"
37# endif
38# endif
39# define PACPUS_COMP_MSVC PACPUS_VERSION_NUMBER(\
40 _MSC_VER/100-6,\
41 _MSC_VER%100,\
42 PACPUS_COMP_MSVC_BUILD)
43#endif
44
45#if PACPUS_COMP_MSVC
46# define PACPUS_COMP_MSVC_AVAILABLE
47#endif
48
49#define PACPUS_COMP_MSVC_NAME "Microsoft Visual C/C++"
50
51////////////////////////////////////////////////////////////////////////////////
52
53#define PACPUS_COMP_GNUC PACPUS_VERSION_NUMBER_NOT_AVAILABLE
54
55#if defined(__GNUC__)
56# undef PACPUS_COMP_GNUC
57# if !defined(PACPUS_COMP_GNUC) && defined(__GNUC_PATCHLEVEL__)
58# define PACPUS_COMP_GNUC \
59 PACPUS_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
60# endif
61# if !defined(PACPUS_COMP_GNUC)
62# define PACPUS_COMP_GNUC \
63 PACPUS_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,0)
64# endif
65#endif
66
67#if PACPUS_COMP_GNUC
68# define PACPUS_COMP_GNUC_AVAILABLE
69#endif
70
71#define PACPUS_COMP_GNUC_NAME "Gnu GCC C/C++"
72
73////////////////////////////////////////////////////////////////////////////////
74
75#define PACPUS_COMP_CLANG PACPUS_VERSION_NUMBER_NOT_AVAILABLE
76
77#if defined(__clang__)
78# undef PACPUS_COMP_CLANG
79# define PACPUS_COMP_CLANG PACPUS_VERSION_NUMBER(__clang_major__,__clang_minor__,__clang_patchlevel__)
80#endif
81
82#if PACPUS_COMP_CLANG
83# define PACPUS_COMP_CLANG_AVAILABLE
84#endif
85
86#define PACPUS_COMP_CLANG_NAME "Clang"
87
88////////////////////////////////////////////////////////////////////////////////
89
90#endif // PACPUS_PREDEF_COMPILER_H
Note: See TracBrowser for help on using the repository browser.