duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

compiler.hpp (4405B)


      1 #ifndef _C4_COMPILER_HPP_
      2 #define _C4_COMPILER_HPP_
      3 
      4 /** @file compiler.hpp Provides compiler information macros
      5  * @ingroup basic_headers */
      6 
      7 #include "c4/platform.hpp"
      8 
      9 // Compilers:
     10 //      C4_MSVC
     11 //             Visual Studio 2022: MSVC++ 17, 1930
     12 //             Visual Studio 2019: MSVC++ 16, 1920
     13 //             Visual Studio 2017: MSVC++ 15
     14 //             Visual Studio 2015: MSVC++ 14
     15 //             Visual Studio 2013: MSVC++ 13
     16 //             Visual Studio 2013: MSVC++ 12
     17 //             Visual Studio 2012: MSVC++ 11
     18 //             Visual Studio 2010: MSVC++ 10
     19 //             Visual Studio 2008: MSVC++ 09
     20 //             Visual Studio 2005: MSVC++ 08
     21 //      C4_CLANG
     22 //      C4_GCC
     23 //      C4_ICC (intel compiler)
     24 /** @see http://sourceforge.net/p/predef/wiki/Compilers/ for a list of compiler identifier macros */
     25 /** @see https://msdn.microsoft.com/en-us/library/b0084kay.aspx for VS2013 predefined macros */
     26 
     27 #if defined(_MSC_VER) && !defined(__clang__)
     28 #   define C4_MSVC
     29 #   define C4_MSVC_VERSION_2022 17
     30 #   define C4_MSVC_VERSION_2019 16
     31 #   define C4_MSVC_VERSION_2017 15
     32 #   define C4_MSVC_VERSION_2015 14
     33 #   define C4_MSVC_VERSION_2013 12
     34 #   define C4_MSVC_VERSION_2012 11
     35 #   if _MSC_VER >= 1930
     36 #       define C4_MSVC_VERSION C4_MSVC_VERSION_2022  // visual studio 2022
     37 #       define C4_MSVC_2022
     38 #   elif _MSC_VER >= 1920
     39 #       define C4_MSVC_VERSION C_4MSVC_VERSION_2019  // visual studio 2019
     40 #       define C4_MSVC_2019
     41 #   elif _MSC_VER >= 1910
     42 #       define C4_MSVC_VERSION C4_MSVC_VERSION_2017  // visual studio 2017
     43 #       define C4_MSVC_2017
     44 #   elif _MSC_VER == 1900
     45 #       define C4_MSVC_VERSION C4_MSVC_VERSION_2015  // visual studio 2015
     46 #       define C4_MSVC_2015
     47 #   elif _MSC_VER == 1800
     48 #       error "MSVC version not supported"
     49 #       define C4_MSVC_VERSION C4_MSVC_VERSION_2013  // visual studio 2013
     50 #       define C4_MSVC_2013
     51 #   elif _MSC_VER == 1700
     52 #       error "MSVC version not supported"
     53 #       define C4_MSVC_VERSION C4_MSVC_VERSION_2012  // visual studio 2012
     54 #       define C4_MSVC_2012
     55 #   elif _MSC_VER == 1600
     56 #       error "MSVC version not supported"
     57 #       define C4_MSVC_VERSION 10  // visual studio 2010
     58 #       define C4_MSVC_2010
     59 #   elif _MSC_VER == 1500
     60 #       error "MSVC version not supported"
     61 #       define C4_MSVC_VERSION 09  // visual studio 2008
     62 #       define C4_MSVC_2008
     63 #   elif _MSC_VER == 1400
     64 #       error "MSVC version not supported"
     65 #       define C4_MSVC_VERSION 08  // visual studio 2005
     66 #       define C4_MSVC_2005
     67 #   else
     68 #       error "MSVC version not supported"
     69 #   endif // _MSC_VER
     70 #else
     71 #   define C4_MSVC_VERSION 0   // visual studio not present
     72 #   define C4_GCC_LIKE
     73 #   ifdef __INTEL_COMPILER // check ICC before checking GCC, as ICC defines __GNUC__ too
     74 #       define C4_ICC
     75 #       define C4_ICC_VERSION __INTEL_COMPILER
     76 #   elif defined(__APPLE_CC__)
     77 #       define C4_XCODE
     78 #       if defined(__clang__)
     79 #           define C4_CLANG
     80 #           ifndef __apple_build_version__
     81 #               define C4_CLANG_VERSION C4_VERSION_ENCODED(__clang_major__, __clang_minor__, __clang_patchlevel__)
     82 #           else
     83 #               define C4_CLANG_VERSION __apple_build_version__
     84 #           endif
     85 #       else
     86 #           define C4_XCODE_VERSION __APPLE_CC__
     87 #       endif
     88 #   elif defined(__clang__)
     89 #       define C4_CLANG
     90 #       ifndef __apple_build_version__
     91 #           define C4_CLANG_VERSION C4_VERSION_ENCODED(__clang_major__, __clang_minor__, __clang_patchlevel__)
     92 #       else
     93 #           define C4_CLANG_VERSION __apple_build_version__
     94 #       endif
     95 #   elif defined(__GNUC__)
     96 #       define C4_GCC
     97 #       if defined(__GNUC_PATCHLEVEL__)
     98 #           define C4_GCC_VERSION C4_VERSION_ENCODED(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
     99 #       else
    100 #           define C4_GCC_VERSION C4_VERSION_ENCODED(__GNUC__, __GNUC_MINOR__, 0)
    101 #       endif
    102 #       if __GNUC__ < 5
    103 #           if __GNUC__ == 4 && __GNUC_MINOR__ >= 8
    104 // provided by cmake sub-project
    105 #               include "c4/gcc-4.8.hpp"
    106 #           else
    107 // we do not support GCC < 4.8:
    108 //  * misses std::is_trivially_copyable
    109 //  * misses std::align
    110 //  * -Wshadow has false positives when a local function parameter has the same name as a method
    111 #               error "GCC < 4.8 is not supported"
    112 #           endif
    113 #       endif
    114 #   endif
    115 #endif // defined(C4_WIN) && defined(_MSC_VER)
    116 
    117 #endif /* _C4_COMPILER_HPP_ */