[cfe-commits] r93312 - in /cfe/trunk: docs/LanguageExtensions.html lib/Lex/PPMacroExpansion.cpp test/Lexer/has_feature_cxx0x .cpp

Sebastian Redl sebastian.redl at getdesigned.at
Wed Jan 13 00:44:43 PST 2010


On Wed, 13 Jan 2010 08:31:50 -0000, Sean Hunt <rideau3 at gmail.com> wrote:
> Author: coppro
> Date: Wed Jan 13 02:31:49 2010
> New Revision: 93312
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=93312&view=rev
> Log:
> Add a bunch more feature-checking macros for C++0x features. Some of
these
> are
> disabled with the intent that users can start with them now and not have
> to change
> a thing to have them work when we implement the features.
> 
>
==============================================================================
> --- cfe/trunk/docs/LanguageExtensions.html (original)
> +++ cfe/trunk/docs/LanguageExtensions.html Wed Jan 13 02:31:49 2010
> +
> +<h3 id="cxx_concepts">C++ TR <tt>concepts</tt></h3>
> +
> +<p>Use <tt>__has_feature(cxx_lambdas)</tt> to determine if support for

__has_feature(cxx_concepts)

>
==============================================================================
> --- cfe/trunk/test/Lexer/has_feature_cxx0x.cpp (added)
> +++ cfe/trunk/test/Lexer/has_feature_cxx0x.cpp Wed Jan 13 02:31:49 2010
> @@ -0,0 +1,101 @@
> +// RUN: %clang -E -std=c++0x %s -o - | FileCheck
--check-prefix=CHECK-0X
> %s
> +// RUN: %clang -E %s -o - | FileCheck --check-prefix=CHECK-NO-0X %s
> +
> +#if __has_feature(cxx_lambdas)
> +int lambdas();
> +#else
> +int no_lambdas();
> +#endif
> +
> +// CHECK-0X: no_lambdas
> +// CHECK-NO-0X: no_lambdas
> +
> +
> +#if __has_feature(cxx_nullptr)
> +int nullptr();

It's probably not a good idea to use the keyword nullptr in the path that
expects it to exist. Even though this will only get preprocessed, it still
looks wrong.

> +
> +#if __has_feature(cxx_decltype)
> +int decltype();

Same here.

> +
> +#if __has_feature(cxx_static_assert)
> +int static_assert();

And here.






More information about the cfe-commits mailing list