119 lines
4.4 KiB
C
119 lines
4.4 KiB
C
/**
|
|
* @file include/ActivMiddleware/Config/Compilers/VisualC.h
|
|
*
|
|
* @brief Microsoft Visual C++ configuration file.
|
|
*/
|
|
|
|
#if (!defined ACTIV_CONFIG_COMPILERS_VISUAL_C_H)
|
|
#define ACTIV_CONFIG_COMPILERS_VISUAL_C_H
|
|
|
|
static_assert(ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(11, 0) == 1700, "ACTIV_MAKE_VISUAL_C_COMPILER_VERSION incorrect for vc110");
|
|
static_assert(ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(12, 0) == 1800, "ACTIV_MAKE_VISUAL_C_COMPILER_VERSION incorrect for vc120");
|
|
static_assert(ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 0) == 1900, "ACTIV_MAKE_VISUAL_C_COMPILER_VERSION incorrect for vc140");
|
|
static_assert(ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 1) == 1910, "ACTIV_MAKE_VISUAL_C_COMPILER_VERSION incorrect for vc141");
|
|
static_assert(ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 2) == 1920, "ACTIV_MAKE_VISUAL_C_COMPILER_VERSION incorrect for vc142");
|
|
static_assert(ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 3) == 1930, "ACTIV_MAKE_VISUAL_C_COMPILER_VERSION incorrect for vc143");
|
|
|
|
#if (ACTIV_VISUAL_C_COMPILER_VERSION < 1910) || (ACTIV_VISUAL_C_COMPILER_VERSION >= 1940)
|
|
#error VC++ version not supported. Check the behavior of ACTIV_MAKE_VISUAL_C_COMPILER_VERSION when adding a new compiler version.
|
|
#endif
|
|
|
|
#define ACTIV_COMPILER_NAME "Microsoft C++ " ACTIV_STRINGIZE(ACTIV_VISUAL_C_COMPILER_VERSION)
|
|
|
|
#define ACTIV_BUILDING_DLL_EXPORTED_API __declspec (dllexport)
|
|
#define ACTIV_BUILDING_DLL_INLINE_API
|
|
#define ACTIV_BUILDING_DLL_LOCAL_API
|
|
#define ACTIV_USING_DLL_EXPORTED_API __declspec (dllimport)
|
|
#define ACTIV_USING_DLL_INLINE_API
|
|
#define ACTIV_USING_DLL_LOCAL_API
|
|
|
|
#define ACTIV_BUILDING_LIB_EXPORTED_API
|
|
#define ACTIV_BUILDING_LIB_INLINE_API
|
|
#define ACTIV_BUILDING_LIB_LOCAL_API
|
|
#define ACTIV_USING_LIB_EXPORTED_API
|
|
#define ACTIV_USING_LIB_INLINE_API
|
|
#define ACTIV_USING_LIB_LOCAL_API
|
|
|
|
/**
|
|
* @brief Define rules for exporting template member functions.
|
|
*
|
|
* The Intel & Visual C++ compilers have different rules for __declspec exporting template
|
|
* instantiations from dlls. Use ACTIV_TEMPLATE_API as a workaround, e.g.
|
|
*
|
|
* class Example
|
|
* {
|
|
* template \<typename T\>
|
|
* ACTIV_TEMPLATE_API(MY_LIB_API) void Fn(T &);
|
|
* };
|
|
*
|
|
* @param a __declspec macro, e.g. ACTIV_BASE_API.
|
|
*/
|
|
#define ACTIV_TEMPLATE_API(a) a
|
|
|
|
#if (!defined ACTIV_DECLARE_TEMPLATE_PARAMETER_FRIEND)
|
|
#define ACTIV_DECLARE_TEMPLATE_PARAMETER_FRIEND(T) friend T
|
|
#endif
|
|
|
|
//! Ensure a function is always inlined.
|
|
#define ACTIV_FORCE_INLINE __forceinline
|
|
|
|
//! Ensure a function is never inlined.
|
|
#define ACTIV_NEVER_INLINE __declspec(noinline)
|
|
|
|
#define ACTIV_HAS_INTTYPES_H
|
|
|
|
// Turn off annoying "C4355: 'this' : used in base member initializer list" warning.
|
|
#pragma warning(disable:4355)
|
|
|
|
// Turn off annoying "C4163: not available as an intrinsic function" warning.
|
|
#pragma warning(disable:4163)
|
|
|
|
// Turn off annoying "C4996: : 'blah' was declared deprecated" warning.
|
|
#pragma warning(disable:4996)
|
|
|
|
// Turn off annoying "warning C4258: 'iter' : definition from the for loop is ignored..." warning.
|
|
#pragma warning(disable:4258)
|
|
|
|
// Turn off annoying "warning C4309: 'static_cast' : truncation of constant value" warning.
|
|
#pragma warning(disable:4309)
|
|
|
|
#if (ACTIV_VISUAL_C_COMPILER_VERSION < ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 2))
|
|
// VS2015, VS2017: Bug in dbghelp.h. "warning C4091: 'typedef ': ignored on left of '' when no variable is declared".
|
|
#pragma warning(disable:4091)
|
|
#endif
|
|
|
|
#if (!defined _CRT_SECURE_NO_DEPRECATE)
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
#endif
|
|
|
|
#if (defined _M_CEE)
|
|
// nullptr has issues with /CLR.
|
|
#define ACTIV_NULLPTR __nullptr
|
|
#endif
|
|
|
|
#if (defined _MSVC_LANG)
|
|
// __cplusplus is always 199711L unless the /Zc:__cplusplus compiler option is enabled.
|
|
// Use ACTIV_CPLUSPLUS instead.
|
|
#define ACTIV_CPLUSPLUS _MSVC_LANG
|
|
#else
|
|
// Assume version is large enough for C++11.
|
|
#define ACTIV_CPLUSPLUS ACTIV_CPLUSPLUS_11
|
|
#endif
|
|
|
|
// It seems that _Pragma is not available in vc141.
|
|
// Only apply padding warnings on 64 bit.
|
|
#if (ACTIV_VISUAL_C_COMPILER_VERSION >= ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 2)) && (ACTIV_PROCESSOR_WORD_SIZE == 64)
|
|
|
|
//! Start enablement of compiler error on struct padding.
|
|
#define ACTIV_ENABLE_ERROR_ON_PADDING_START \
|
|
_Pragma("warning(push)") \
|
|
_Pragma("warning(error:4820)")
|
|
|
|
//! End enablement of compiler error on struct padding.
|
|
#define ACTIV_ENABLE_ERROR_ON_PADDING_END \
|
|
_Pragma("warning(pop)")
|
|
|
|
#endif // (ACTIV_VISUAL_C_COMPILER_VERSION >= ACTIV_MAKE_VISUAL_C_COMPILER_VERSION(14, 2)) && (ACTIV_PROCESSOR_WORD_SIZE == 64)
|
|
|
|
#endif // (!defined ACTIV_CONFIG_COMPILERS_VISUAL_C_H)
|