1 /*
2 Copyright Rene Rivera 2008-2015
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE_1_0.txt or copy at
5 http://www.boost.org/LICENSE_1_0.txt)
6 */
7 
8 #ifndef BOOST_PREDEF_COMPILER_GCC_H
9 #define BOOST_PREDEF_COMPILER_GCC_H
10 
11 /* Other compilers that emulate this one need to be detected first. */
12 
13 #include <boost/predef/compiler/clang.h>
14 
15 #include <boost/predef/version_number.h>
16 #include <boost/predef/make.h>
17 
18 /* tag::reference[]
19 = `BOOST_COMP_GNUC`
20 
21 http://en.wikipedia.org/wiki/GNU_Compiler_Collection[Gnu GCC C/{CPP}] compiler.
22 Version number available as major, minor, and patch (if available).
23 
24 [options="header"]
25 |===
26 | {predef_symbol} | {predef_version}
27 
28 | `+__GNUC__+` | {predef_detection}
29 
30 | `+__GNUC__+`, `+__GNUC_MINOR__+`, `+__GNUC_PATCHLEVEL__+` | V.R.P
31 | `+__GNUC__+`, `+__GNUC_MINOR__+` | V.R.0
32 |===
33 */ // end::reference[]
34 
35 #define BOOST_COMP_GNUC BOOST_VERSION_NUMBER_NOT_AVAILABLE
36 
37 #if defined(__GNUC__)
38 #   if !defined(BOOST_COMP_GNUC_DETECTION) && defined(__GNUC_PATCHLEVEL__)
39 #       define BOOST_COMP_GNUC_DETECTION \
40             BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__)
41 #   endif
42 #   if !defined(BOOST_COMP_GNUC_DETECTION)
43 #       define BOOST_COMP_GNUC_DETECTION \
44             BOOST_VERSION_NUMBER(__GNUC__,__GNUC_MINOR__,0)
45 #   endif
46 #endif
47 
48 #ifdef BOOST_COMP_GNUC_DETECTION
49 #   if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
50 #       define BOOST_COMP_GNUC_EMULATED BOOST_COMP_GNUC_DETECTION
51 #   else
52 #       undef BOOST_COMP_GNUC
53 #       define BOOST_COMP_GNUC BOOST_COMP_GNUC_DETECTION
54 #   endif
55 #   define BOOST_COMP_GNUC_AVAILABLE
56 #   include <boost/predef/detail/comp_detected.h>
57 #endif
58 
59 #define BOOST_COMP_GNUC_NAME "Gnu GCC C/C++"
60 
61 #endif
62 
63 #include <boost/predef/detail/test.h>
64 BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC,BOOST_COMP_GNUC_NAME)
65 
66 #ifdef BOOST_COMP_GNUC_EMULATED
67 #include <boost/predef/detail/test.h>
68 BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_GNUC_EMULATED,BOOST_COMP_GNUC_NAME)
69 #endif
70