Path: blob/master/dep/rapidyaml/include/c4/compiler.hpp
4261 views
#ifndef _C4_COMPILER_HPP_1#define _C4_COMPILER_HPP_23/** @file compiler.hpp Provides compiler information macros4* @ingroup basic_headers */56#include "c4/platform.hpp"78// Compilers:9// C4_MSVC10// Visual Studio 2022: MSVC++ 17, 193011// Visual Studio 2019: MSVC++ 16, 192012// Visual Studio 2017: MSVC++ 1513// Visual Studio 2015: MSVC++ 1414// Visual Studio 2013: MSVC++ 1315// Visual Studio 2013: MSVC++ 1216// Visual Studio 2012: MSVC++ 1117// Visual Studio 2010: MSVC++ 1018// Visual Studio 2008: MSVC++ 0919// Visual Studio 2005: MSVC++ 0820// C4_CLANG21// C4_GCC22// C4_ICC (intel compiler)23/** @see http://sourceforge.net/p/predef/wiki/Compilers/ for a list of compiler identifier macros */24/** @see https://msdn.microsoft.com/en-us/library/b0084kay.aspx for VS2013 predefined macros */2526#if defined(_MSC_VER) && !defined(__clang__)27# define C4_MSVC28# define C4_MSVC_VERSION_2022 1729# define C4_MSVC_VERSION_2019 1630# define C4_MSVC_VERSION_2017 1531# define C4_MSVC_VERSION_2015 1432# define C4_MSVC_VERSION_2013 1233# define C4_MSVC_VERSION_2012 1134# if _MSC_VER >= 193035# define C4_MSVC_VERSION C4_MSVC_VERSION_2022 // visual studio 202236# define C4_MSVC_202237# elif _MSC_VER >= 192038# define C4_MSVC_VERSION C_4MSVC_VERSION_2019 // visual studio 201939# define C4_MSVC_201940# elif _MSC_VER >= 191041# define C4_MSVC_VERSION C4_MSVC_VERSION_2017 // visual studio 201742# define C4_MSVC_201743# elif _MSC_VER == 190044# define C4_MSVC_VERSION C4_MSVC_VERSION_2015 // visual studio 201545# define C4_MSVC_201546# elif _MSC_VER == 180047# error "MSVC version not supported"48# define C4_MSVC_VERSION C4_MSVC_VERSION_2013 // visual studio 201349# define C4_MSVC_201350# elif _MSC_VER == 170051# error "MSVC version not supported"52# define C4_MSVC_VERSION C4_MSVC_VERSION_2012 // visual studio 201253# define C4_MSVC_201254# elif _MSC_VER == 160055# error "MSVC version not supported"56# define C4_MSVC_VERSION 10 // visual studio 201057# define C4_MSVC_201058# elif _MSC_VER == 150059# error "MSVC version not supported"60# define C4_MSVC_VERSION 09 // visual studio 200861# define C4_MSVC_200862# elif _MSC_VER == 140063# error "MSVC version not supported"64# define C4_MSVC_VERSION 08 // visual studio 200565# define C4_MSVC_200566# else67# error "MSVC version not supported"68# endif // _MSC_VER69#else70# define C4_MSVC_VERSION 0 // visual studio not present71# define C4_GCC_LIKE72# ifdef __INTEL_COMPILER // check ICC before checking GCC, as ICC defines __GNUC__ too73# define C4_ICC74# define C4_ICC_VERSION __INTEL_COMPILER75# elif defined(__APPLE_CC__)76# define C4_XCODE77# if defined(__clang__)78# define C4_CLANG79# ifndef __apple_build_version__80# define C4_CLANG_VERSION C4_VERSION_ENCODED(__clang_major__, __clang_minor__, __clang_patchlevel__)81# else82# define C4_CLANG_VERSION __apple_build_version__83# endif84# else85# define C4_XCODE_VERSION __APPLE_CC__86# endif87# elif defined(__clang__)88# define C4_CLANG89# ifndef __apple_build_version__90# define C4_CLANG_VERSION C4_VERSION_ENCODED(__clang_major__, __clang_minor__, __clang_patchlevel__)91# else92# define C4_CLANG_VERSION __apple_build_version__93# endif94# elif defined(__GNUC__)95# define C4_GCC96# if defined(__GNUC_PATCHLEVEL__)97# define C4_GCC_VERSION C4_VERSION_ENCODED(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)98# else99# define C4_GCC_VERSION C4_VERSION_ENCODED(__GNUC__, __GNUC_MINOR__, 0)100# endif101# if __GNUC__ < 5102# if __GNUC__ == 4 && __GNUC_MINOR__ >= 8103// provided by cmake sub-project104# include "c4/gcc-4.8.hpp"105# else106// we do not support GCC < 4.8:107// * misses std::is_trivially_copyable108// * misses std::align109// * -Wshadow has false positives when a local function parameter has the same name as a method110# error "GCC < 4.8 is not supported"111# endif112# endif113# endif114#endif // defined(C4_WIN) && defined(_MSC_VER)115116#endif /* _C4_COMPILER_HPP_ */117118119