[cfe-dev] Libcxx marco using question

Bjorn Reese breese at mail1.stofanet.dk
Thu Sep 9 09:55:06 PDT 2010


On 2010-09-09 03:34, 罗勇刚(Yonggang Luo)  wrote:

> So the marco should be
> #if defined(__clang__) || (__GNUC__ == 4&&  __GNUC_MINOR__>= 3) ||
> (__GNUC__>=5)

Or...

#if defined(__GNUC__)
# if defined(__GNUC_PATCHLEVEL__)
#  define __GNUC_VERSION__ (__GNUC__ * 10000 \
                             + __GNUC_MINOR__ * 100 \
                             + __GNUC_PATCHLEVEL__)
# else
#  define __GNUC_VERSION__ (__GNUC__ * 10000 \
                             + __GNUC_MINOR__ * 100)
# endif
#endif

which can then be used as follows:

#if defined(__clang__) || (__GNUC_VERSION__ >= 40300)



More information about the cfe-dev mailing list