1 /************************************************************************** 2 * 3 * Copyright 2022 Yonggang Luo 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28 /** 29 * @file 30 * Compiler configuration defines. 31 * 32 * See: 33 * - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html 34 * - echo | gcc -dM -E - | sort 35 * - http://msdn.microsoft.com/en-us/library/b0084kay.aspx 36 * - https://sourceforge.net/p/predef/wiki/Home/ 37 */ 38 39 #ifndef UTIL_DETECT_CC_H_ 40 #define UTIL_DETECT_CC_H_ 41 42 /* 43 * Compiler 44 */ 45 46 #if defined(__GNUC__) 47 #define DETECT_CC_GCC 1 48 #define DETECT_CC_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) 49 #endif 50 51 /* 52 * Meaning of _MSC_VER value: 53 * - 1800: Visual Studio 2013 54 * - 1700: Visual Studio 2012 55 * - 1600: Visual Studio 2010 56 * - 1500: Visual Studio 2008 57 * - 1400: Visual C++ 2005 58 * - 1310: Visual C++ .NET 2003 59 * - 1300: Visual C++ .NET 2002 60 * 61 * __MSC__ seems to be an old macro -- it is not pre-defined on recent MSVC 62 * versions. 63 */ 64 #if defined(_MSC_VER) || defined(__MSC__) 65 #define DETECT_CC_MSVC 1 66 #endif 67 68 #if defined(__ICL) 69 #define DETECT_CC_ICL 1 70 #endif 71 72 #ifndef DETECT_CC_GCC 73 #define DETECT_CC_GCC 0 74 #endif 75 76 #ifndef DETECT_CC_GCC_VERSION 77 #define DETECT_CC_GCC_VERSION 0 78 #endif 79 80 #ifndef DETECT_CC_MSVC 81 #define DETECT_CC_MSVC 0 82 #endif 83 84 #ifndef DETECT_CC_ICL 85 #define DETECT_CC_ICL 0 86 #endif 87 88 #endif /* UTIL_DETECT_CC_H_ */ 89