[cfe-dev] Libcxx marco using question

Howard Hinnant hhinnant at apple.com
Thu Sep 9 06:41:19 PDT 2010


On Sep 8, 2010, at 9:34 PM, 罗勇刚(Yonggang Luo) wrote:

> #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

This is a good suggestion, thanks.  And thanks for the subsequent patches.  I had been testing against g++-4.4 only in -std=c++0x mode.  So I think I'll mix __GXX_EXPERIMENTAL_CXX0X__ into your good suggestion.

-Howard
 



More information about the cfe-dev mailing list