Files

114 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 < 1900) || (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 Declare an "uninitialized" variable such that it does not create a compilation warning.
*
* Certain compilers (e.g. gcc 3.4) are not "intelligent" enough to figure out that an uninitialized variable
* will be initialized before use in all code paths. Use this macro to declare and initialize such a variable
* with a dummy value to bypass such warnings. With compilers that do not suffer from this problem, this macro
* just declares the variable uninitialized.
*/
#define ACTIV_DECLARE_UNINITIALIZED_VARIABLE(type, name, dummyValue) type name
/**
* @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
#endif // (!defined ACTIV_CONFIG_COMPILERS_VISUAL_C_H)