VirtualBox

Changeset 60843 in vbox for trunk/include/iprt/cdefs.h


Ignore:
Timestamp:
May 4, 2016 10:08:53 PM (9 years ago)
Author:
vboxsync
Message:

iprt/cdefs.h: Added RT_MSC_PREREQ, RT_MSC_PREREQ_EX and RT_GCC_PREREQ_EX. With the two MSC macros are a bunch of version value defines, RT_MSC_VER_XXX, for the most recent Visual C++ compilers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r60192 r60843  
    156156/** @def RT_GNUC_PREREQ
    157157 * Shorter than fiddling with __GNUC__ and __GNUC_MINOR__.
     158 *
     159 * @param   a_MinMajor      Minimum major version
     160 * @param   a_MinMinor      The minor version number part.
     161 */
     162#define RT_GNUC_PREREQ(a_MinMajor, a_MinMinor)      RT_GNUC_PREREQ_EX(a_MinMajor, a_MinMinor, 0)
     163/** @def RT_GNUC_PREREQ_EX
     164 * Simplified way of checking __GNUC__ and __GNUC_MINOR__ regardless of actual
     165 * compiler used, returns @a a_OtherRet for other compilers.
     166 *
     167 * @param   a_MinMajor      Minimum major version
     168 * @param   a_MinMinor      The minor version number part.
     169 * @param   a_OtherRet      What to return for non-GCC compilers.
    158170 */
    159171#if defined(__GNUC__) && defined(__GNUC_MINOR__)
    160 # define RT_GNUC_PREREQ(major, minor) \
    161     ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((major) << 16) + (minor))
    162 #else
    163 # define RT_GNUC_PREREQ(major, minor) 0
    164 #endif
     172# define RT_GNUC_PREREQ_EX(a_MinMajor, a_MinMinor, a_OtherRet) \
     173    ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((a_MinMajor) << 16) + (a_MinMinor))
     174#else
     175# define RT_GNUC_PREREQ_EX(a_MinMajor, a_MinMinor, a_OtherRet) (a_OtherRet)
     176#endif
     177
     178/** @def RT_MSC_PREREQ
     179 * Convenient way of checking _MSC_VER regardless of actual compiler used
     180 * (returns false if not MSC).
     181 *
     182 * @param   a_MinVer        Preferably a RT_MSC_VER_XXX value.
     183 */
     184#define RT_MSC_PREREQ(a_MinVer)                     RT_MSC_PREREQ_EX(a_MinVer, 0)
     185/** @def RT_MSC_PREREQ_EX
     186 * Convenient way of checking _MSC_VER regardless of actual compiler used,
     187 * returns @a a_OtherRet for other compilers.
     188 *
     189 * @param   a_MinVer        Preferably a RT_MSC_VER_XXX value.
     190 * @param   a_OtherRet      What to return for non-MSC compilers.
     191 */
     192#if defined(_MSC_VER)
     193# define RT_MSC_PREREQ_EX(a_MinVer, a_OtherRet)     ( (_MSC_VER) >= (a_MinVer) )
     194#else
     195# define RT_MSC_PREREQ_EX(a_MinVer, a_OtherRet)     (a_OtherRet)
     196#endif
     197/** @name RT_MSC_VER_XXX - _MSC_VER values to use with RT_MSC_PREREQ.
     198 * @remarks The VCxxx values are derived from the CRT DLLs shipping with the
     199 *          compilers.
     200 * @{ */
     201#define RT_MSC_VER_VC50     (1100)              /**< Visual C++ 5.0. */
     202#define RT_MSC_VER_VC60     (1200)              /**< Visual C++ 6.0. */
     203#define RT_MSC_VER_VC70     (1300)              /**< Visual C++ 7.0. */
     204#define RT_MSC_VER_VC70     (1300)              /**< Visual C++ 7.0. */
     205#define RT_MSC_VER_VS2003   (1310)              /**< Visual Studio 2003, aka Visual C++ 7.1. */
     206#define RT_MSC_VER_VC71     RT_MSC_VER_VS2003   /**< Visual C++ 7.1, aka Visual Studio 2003. */
     207#define RT_MSC_VER_VS2005   (1400)              /**< Visual Studio 2005. */
     208#define RT_MSC_VER_VC80     RT_MSC_VER_VS2005   /**< Visual C++ 8.0, aka Visual Studio 2008. */
     209#define RT_MSC_VER_VS2008   (1500)              /**< Visual Studio 2008. */
     210#define RT_MSC_VER_VC90     RT_MSC_VER_VS2008   /**< Visual C++ 9.0, aka Visual Studio 2008. */
     211#define RT_MSC_VER_VS2010   (1600)              /**< Visual Studio 2010. */
     212#define RT_MSC_VER_VC100    RT_MSC_VER_VS2010   /**< Visual C++ 10.0, aka Visual Studio 2010. */
     213#define RT_MSC_VER_VS2012   (1700)              /**< Visual Studio 2012. */
     214#define RT_MSC_VER_VC110    RT_MSC_VER_VS2012   /**< Visual C++ 11.0, aka Visual Studio 2012. */
     215#define RT_MSC_VER_VS2013   (1800)              /**< Visual Studio 2013. */
     216#define RT_MSC_VER_VC120    RT_MSC_VER_VS2013   /**< Visual C++ 12.0, aka Visual Studio 2013. */
     217#define RT_MSC_VER_VS2015   (1900)              /**< Visual Studio 2015. */
     218#define RT_MSC_VER_VC140    RT_MSC_VER_VS2015   /**< Visual C++ 14.0, aka Visual Studio 2015. */
     219/** @} */
    165220
    166221/** @def __X86__
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette