mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 07:31:28 +00:00
[Clang] Update feature test macros for Clang 18 (#78991)
* Set `__cpp_auto_cast`, as per https://github.com/cplusplus/CWG/issues/281 * Support `__has_extension(cxx_generalized_nttp)` in C++20 as the feature isn't stable enough for a feature test macro * Support `__has_extension(cxx_explicit_this_parameter)` in c++23 as the feature isn't stable enough for a feature test macro
This commit is contained in:
parent
0ab9c382d4
commit
02a28ee8d9
@ -185,7 +185,8 @@ C++20 Feature Support
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
- Implemented `P1907R1 <https://wg21.link/P1907R1>` which extends allowed non-type template argument
|
||||
kinds with e.g. floating point values and pointers and references to subobjects.
|
||||
This feature is still experimental. Accordingly, `__cpp_nontype_template_args` was not updated.
|
||||
This feature is still experimental. Accordingly, ``__cpp_nontype_template_args`` was not updated.
|
||||
However, its support can be tested with ``__has_extension(cxx_generalized_nttp)``.
|
||||
|
||||
C++23 Feature Support
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
@ -194,6 +195,7 @@ C++23 Feature Support
|
||||
`CWG2653 <https://wg21.link/CWG2653>`_, `CWG2687 <https://wg21.link/CWG2687>`_). Because the
|
||||
support for this feature is still experimental, the feature test macro ``__cpp_explicit_this_parameter``
|
||||
was not set in this version.
|
||||
However, its support can be tested with ``__has_extension(cxx_explicit_this_parameter)``.
|
||||
|
||||
- Added a separate warning to warn the use of attributes on lambdas as a C++23 extension
|
||||
in previous language versions: ``-Wc++23-lambda-attributes``.
|
||||
@ -1045,6 +1047,8 @@ Bug Fixes to C++ Support
|
||||
- Remove recorded `#pragma once` state for headers included in named modules.
|
||||
Fixes (`#77995 <https://github.com/llvm/llvm-project/issues/77995>`_)
|
||||
|
||||
- Set the ``__cpp_auto_cast`` feature test macro in C++23 mode.
|
||||
|
||||
Bug Fixes to AST Handling
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Fixed an import failure of recursive friend class template.
|
||||
|
@ -269,6 +269,10 @@ EXTENSION(cxx_fixed_enum, true)
|
||||
EXTENSION(cxx_binary_literals, true)
|
||||
EXTENSION(cxx_init_captures, LangOpts.CPlusPlus11)
|
||||
EXTENSION(cxx_variable_templates, LangOpts.CPlusPlus)
|
||||
//C++20
|
||||
EXTENSION(cxx_generalized_nttp, LangOpts.CPlusPlus20)
|
||||
//C++23
|
||||
EXTENSION(cxx_explicit_this_parameter, LangOpts.CPlusPlus23)
|
||||
// Miscellaneous language extensions
|
||||
EXTENSION(overloadable_unmarked, true)
|
||||
EXTENSION(pragma_clang_attribute_namespaces, true)
|
||||
|
@ -728,6 +728,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
|
||||
Builder.defineMacro("__cpp_size_t_suffix", "202011L");
|
||||
Builder.defineMacro("__cpp_if_consteval", "202106L");
|
||||
Builder.defineMacro("__cpp_multidimensional_subscript", "202211L");
|
||||
Builder.defineMacro("__cpp_auto_cast", "202110L");
|
||||
}
|
||||
|
||||
// We provide those C++23 features as extensions in earlier language modes, so
|
||||
|
@ -40,6 +40,11 @@
|
||||
|
||||
// --- C++23 features ---
|
||||
|
||||
#if check(auto_cast, 0, 0, 0, 0, 0, 202110, 202110)
|
||||
#error "wrong value for __cpp_auto_cast"
|
||||
#endif
|
||||
|
||||
|
||||
#if check(implicit_move, 0, 0, 0, 0, 0, 202011, 202011)
|
||||
#error "wrong value for __cpp_implicit_move"
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
// RUN: %clang_cc1 -std=c++98 -E %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -std=c++11 -E %s -o - | FileCheck %s --check-prefix=CHECK11
|
||||
// RUN: %clang_cc1 -std=c++20 -E %s -o - | FileCheck %s --check-prefix=CHECK20
|
||||
// RUN: %clang_cc1 -std=c++23 -E %s -o - | FileCheck %s --check-prefix=CHECK23
|
||||
|
||||
// CHECK: c_static_assert
|
||||
#if __has_extension(c_static_assert)
|
||||
@ -76,3 +78,17 @@ int has_variable_templates();
|
||||
#if __has_extension(cxx_init_captures)
|
||||
int has_init_captures();
|
||||
#endif
|
||||
|
||||
|
||||
// CHECK11-NOT: has_generalized_nttp
|
||||
// CHECK20: has_generalized_nttp
|
||||
#if __has_extension(cxx_generalized_nttp)
|
||||
int has_generalized_nttp();
|
||||
#endif
|
||||
|
||||
|
||||
// CHECK20-NOT: has_explicit_this_parameter
|
||||
// CHECK23: has_explicit_this_parameter
|
||||
#if __has_extension(cxx_explicit_this_parameter)
|
||||
int has_explicit_this_parameter();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user