[cfe-dev] Libcxx marco using question

Eric Christopher echristo at apple.com
Thu Sep 9 10:17:03 PDT 2010


On Sep 9, 2010, at 9:55 AM, Bjorn Reese wrote:

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

FWIW I'm personally for this sort of definition and use for versions :)

-eric





More information about the cfe-dev mailing list