Author: Chuanqi Xu Date: 2023-01-18T10:26:53+08:00 New Revision: f900742746734953e8823319d5c8c40d857c10ea
URL: https://github.com/llvm/llvm-project/commit/f900742746734953e8823319d5c8c40d857c10ea DIFF: https://github.com/llvm/llvm-project/commit/f900742746734953e8823319d5c8c40d857c10ea.diff LOG: [C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag According to https://github.com/llvm/llvm-project/issues/59110, the `-fcoroutines-ts` flag should be deprecated. Reviewed By: aaron.ballman, philnik Differential Revision: https://reviews.llvm.org/D141572 Added: Modified: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/DiagnosticDriverKinds.td clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/coroutines.cpp libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp libcxx/test/libcxx/clang_tidy.sh.cpp libcxx/test/libcxx/double_include.sh.cpp libcxx/test/libcxx/min_max_macros.compile.pass.cpp libcxx/test/libcxx/modules_include.sh.cpp libcxx/test/libcxx/nasty_macros.compile.pass.cpp libcxx/test/libcxx/no_assert_include.compile.pass.cpp libcxx/utils/generate_header_tests.py Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 7ddf9b75d5745..bec3ef261504a 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -553,6 +553,8 @@ Deprecated Compiler Flags has been deprecated. The flag will be removed in Clang 18. ``-ftrivial-auto-var-init=zero`` is now available unconditionally, to be compatible with GCC. +- ``-fcoroutines-ts`` has been deprecated. The flag will be removed in Clang 17. + Please use ``-std=c++20`` or higher to use standard C++ coroutines instead. Modified Compiler Flags ----------------------- diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 6f046cdb7952d..a8483511be85b 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -632,6 +632,11 @@ def warn_drv_libstdcxx_not_found : Warning< "command line to use the libc++ standard library instead">, InGroup<DiagGroup<"stdlibcxx-not-found">>; +def warn_deperecated_fcoroutines_ts_flag : Warning< + "the '-fcoroutines-ts' flag is deprecated and it will be removed in Clang 17; " + "use '-std=c++20' or higher to use standard C++ coroutines instead">, + InGroup<DeprecatedExperimentalCoroutine>; + def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">; def err_drv_invalid_object_mode : Error< diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 212b3faa2dc74..0b17f2a3bec59 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6455,6 +6455,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, if (Args.hasFlag(options::OPT_fcoroutines_ts, options::OPT_fno_coroutines_ts, false) && types::isCXX(InputType)) { + D.Diag(diag::warn_deperecated_fcoroutines_ts_flag); CmdArgs.push_back("-fcoroutines-ts"); } diff --git a/clang/test/Driver/coroutines.cpp b/clang/test/Driver/coroutines.cpp index 99e0ff57dda2e..ae5f268994ed5 100644 --- a/clang/test/Driver/coroutines.cpp +++ b/clang/test/Driver/coroutines.cpp @@ -5,5 +5,6 @@ // RUN: %clang -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-CORO %s // RUN: %clang -fno-coroutines-ts -fcoroutines-ts -### %s 2>&1 | FileCheck -check-prefix=CHECK-HAS-CORO %s +// CHECK-HAS-CORO: the '-fcoroutines-ts' flag is deprecated and it will be removed in Clang 17; use '-std=c++20' or higher to use standard C++ coroutines instead // CHECK-HAS-CORO: -fcoroutines-ts diff --git a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp index dcb5766377b08..7ca6d91b29ab5 100644 --- a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp +++ b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp @@ -199,7 +199,7 @@ int main(int, char**) { return 0; } #endif // RUN: %{build} -DTEST_26 -#if defined(TEST_26) +#if defined(TEST_26) && (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) # include <coroutine> using HandlerType = decltype(std::__libcpp_verbose_abort); #endif diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp index cef418169a9c7..57cabf3699f29 100644 --- a/libcxx/test/libcxx/clang_tidy.sh.cpp +++ b/libcxx/test/libcxx/clang_tidy.sh.cpp @@ -68,7 +68,9 @@ END-SCRIPT #include <complex.h> #include <concepts> #include <condition_variable> -#include <coroutine> +#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) +# include <coroutine> +#endif #include <csetjmp> #include <csignal> #include <cstdarg> diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp index afe9ca60c8af3..ea9fc7bfa8755 100644 --- a/libcxx/test/libcxx/double_include.sh.cpp +++ b/libcxx/test/libcxx/double_include.sh.cpp @@ -69,7 +69,9 @@ END-SCRIPT #include <complex.h> #include <concepts> #include <condition_variable> -#include <coroutine> +#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) +# include <coroutine> +#endif #include <csetjmp> #include <csignal> #include <cstdarg> diff --git a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp index e2098ac03c04e..0d9170bb0fa04 100644 --- a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp @@ -95,8 +95,10 @@ TEST_MACROS(); TEST_MACROS(); #include <condition_variable> TEST_MACROS(); -#include <coroutine> +#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) +# include <coroutine> TEST_MACROS(); +#endif #include <csetjmp> TEST_MACROS(); #include <csignal> diff --git a/libcxx/test/libcxx/modules_include.sh.cpp b/libcxx/test/libcxx/modules_include.sh.cpp index dc0bef2118431..460538b7918ef 100644 --- a/libcxx/test/libcxx/modules_include.sh.cpp +++ b/libcxx/test/libcxx/modules_include.sh.cpp @@ -154,7 +154,7 @@ END-SCRIPT #include <condition_variable> #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_26 -#if defined(TEST_26) +#if defined(TEST_26) && (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) #include <coroutine> #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_27 diff --git a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp index 30ad9a4ed85c1..7896b5edc6005 100644 --- a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp @@ -193,7 +193,9 @@ END-SCRIPT #include <complex.h> #include <concepts> #include <condition_variable> -#include <coroutine> +#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) +# include <coroutine> +#endif #include <csetjmp> #include <csignal> #include <cstdarg> diff --git a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp index 189f48fa2e4a8..ce94592901458 100644 --- a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp +++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp @@ -66,7 +66,9 @@ END-SCRIPT #include <complex.h> #include <concepts> #include <condition_variable> -#include <coroutine> +#if (defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L) +# include <coroutine> +#endif #include <csetjmp> #include <csignal> #include <cstdarg> diff --git a/libcxx/utils/generate_header_tests.py b/libcxx/utils/generate_header_tests.py index 7e920ff1b9bc5..298196328bb4c 100755 --- a/libcxx/utils/generate_header_tests.py +++ b/libcxx/utils/generate_header_tests.py @@ -19,6 +19,9 @@ "filesystem": "!defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)", + # TODO LLVM17: simplify this to __cplusplus >= 202002L + "coroutine": "(defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)", + "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM)", _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits