[cfe-dev] Libcxx marco using question

罗勇刚(Yonggang Luo) luoyonggang at gmail.com
Wed Sep 8 18:34:14 PDT 2010


#if defined(__clang__) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
in file http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits
if this macro is really correct?
if __GNUC__ is 5 and __GNUC_MINOR__ is 2, it's seems this macro won't be passed.

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

And also there is so much same macros define,
so we may using

#if defined(__clang__) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define LIBCXX_SUPPORT_TYPE_TRAITS
#endif


then we using
#ifdef LIBCXX_SUPPORT_TYPE_TRAITS

do something
#else
do something else
#endif

-- 
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo




More information about the cfe-dev mailing list