Document of c-modernization-kit (util) 1.0.0

Loading...
Searching...
No Matches
compiler.h
Go to the documentation of this file.
1
52
53#ifndef COMPILER_H
54#define COMPILER_H
55
56#ifdef DOXYGEN
57 #define COMPILER_MSVC
58 #define COMPILER_CLANG
59 #define COMPILER_GCC
60 #define COMPILER_UNKNOWN
61 #define COMPILER_NAME "name"
62 #define COMPILER_VERSION 0
63#else /* !DOXYGEN */
64 #if defined(_MSC_VER)
65 #define COMPILER_MSVC
66 #define COMPILER_NAME "MSVC"
67 #define COMPILER_VERSION _MSC_VER
68 #elif defined(__clang__)
69 #define COMPILER_CLANG
70 #define COMPILER_NAME "Clang"
71 #define COMPILER_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
72 #elif defined(__GNUC__)
73 #define COMPILER_GCC
74 #define COMPILER_NAME "GCC"
75 #define COMPILER_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
76 #else
77 #define COMPILER_UNKNOWN
78 #define COMPILER_NAME "Unknown"
79 #define COMPILER_VERSION 0
80 #endif
81#endif /* DOXYGEN */
82
83#ifdef DOXYGEN
84 #define FORCE_INLINE
85 #define NO_INLINE
86#else /* !DOXYGEN */
87 #if defined(COMPILER_MSVC)
88 #define FORCE_INLINE __forceinline
89 #define NO_INLINE __declspec(noinline)
90 #elif defined(COMPILER_GCC) || defined(COMPILER_CLANG)
91 #define FORCE_INLINE inline __attribute__((always_inline))
92 #define NO_INLINE __attribute__((noinline))
93 #else
94 #define FORCE_INLINE inline
95 #define NO_INLINE
96 #endif
97#endif /* DOXYGEN */
98
99#endif /* COMPILER_H */