This is an archive of the discontinued LLVM Phabricator instance.

[C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag
ClosedPublic

Authored by ChuanqiXu on Jan 12 2023, 12:29 AM.

Details

Summary

According to the discussion of https://github.com/llvm/llvm-project/issues/59110, we should deprecate the use of -fcoroutines-ts in LLVM16 and remove it in LLVM17.

I've tested this with libcxx and it is fine since we disabled all the warnings for the test of <experimental/coroutine>. See https://github.com/llvm/llvm-project/blob/cefa5cefdce2d5090002c3116403f7e5ca5700b9/libcxx/test/std/experimental/language.support/support.coroutines/lit.local.cfg#L7-L8

Diff Detail

Event Timeline

ChuanqiXu created this revision.Jan 12 2023, 12:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 12:29 AM
ChuanqiXu requested review of this revision.Jan 12 2023, 12:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 12:29 AM
aaron.ballman added a reviewer: Restricted Project.Jan 12 2023, 6:33 AM

Thank you for working on this! I think the Debian CI failure is unrelated, but the libc++ one looks plausibly related:

/home/libcxx-builder/.buildkite-agent/builds/e6f11fd202bc-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1/module.modulemap:773:10: error: module 'std.coroutine' requires feature 'coroutines'
  module coroutine {
         ^
/home/libcxx-builder/.buildkite-agent/builds/e6f11fd202bc-1/llvm-project/libcxx-ci/libcxx/test/libcxx/modules_include.sh.cpp:158:10: note: submodule of top-level module 'std' implicitly imported here
#include <coroutine>
         ^
1 error generated.

adding the libc++ reviewers for awareness.

clang/docs/ReleaseNotes.rst
564
clang/include/clang/Basic/DiagnosticDriverKinds.td
635–638

Slight rewording for style.

Thank you for working on this! I think the Debian CI failure is unrelated, but the libc++ one looks plausibly related:

/home/libcxx-builder/.buildkite-agent/builds/e6f11fd202bc-1/llvm-project/libcxx-ci/build/generic-cxx03/include/c++/v1/module.modulemap:773:10: error: module 'std.coroutine' requires feature 'coroutines'
  module coroutine {
         ^
/home/libcxx-builder/.buildkite-agent/builds/e6f11fd202bc-1/llvm-project/libcxx-ci/libcxx/test/libcxx/modules_include.sh.cpp:158:10: note: submodule of top-level module 'std' implicitly imported here
#include <coroutine>
         ^
1 error generated.

adding the libc++ reviewers for awareness.

Yes, this is related. It should be enough to add "coroutine": "(defined(__cpp_impl_coroutine) && __cpp_impl_coroutine >= 201902L) || (defined(__cpp_coroutines) && __cpp_coroutines >= 201703L)" to libcxx/utils/generate_header_tests.py and run ninja libcxx-generate-files.

After failed to reproduce the error locally, try to follow the instructions from @philnik to see if the CI-Bot will break.

@philnik when I run ninja libcxx-generate-files locally, it says ninja: error: unknown target 'libcxx-generate-files'. The following off is my configuring command:

cmake -G Ninja -S llvm -B build_libcxx_modules -DLLVM_ENABLE_PROJECTS="clang"  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_BUILD_TYPE=Release

Do you know if anything goes wrong?

@philnik when I run ninja libcxx-generate-files locally, it says ninja: error: unknown target 'libcxx-generate-files'. The following off is my configuring command:

cmake -G Ninja -S llvm -B build_libcxx_modules -DLLVM_ENABLE_PROJECTS="clang"  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_BUILD_TYPE=Release

Do you know if anything goes wrong?

It's probably because you're using the bootstrapping build. Since this invokes another CMake command internally to build libc++, the targets aren't available. It should work with cmake -G Ninja -S runtimes -B <...> -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi".

ChuanqiXu updated this revision to Diff 489412.Jan 15 2023, 6:41 PM

Update the header tests.

@philnik when I run ninja libcxx-generate-files locally, it says ninja: error: unknown target 'libcxx-generate-files'. The following off is my configuring command:

cmake -G Ninja -S llvm -B build_libcxx_modules -DLLVM_ENABLE_PROJECTS="clang"  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_BUILD_TYPE=Release

Do you know if anything goes wrong?

It's probably because you're using the bootstrapping build. Since this invokes another CMake command internally to build libc++, the targets aren't available. It should work with cmake -G Ninja -S runtimes -B <...> -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi".

Got it. It fixed my problem.

Now it looks like the failure are not related to the patch. Although there are some clang-format related failures, the related changes are generated automatically and I roughly remember libcxx don't use libcxx. @philnik would you like to take a look to ensure if the failures are related to the patch or not?

Move the release note to Deprecated Compiler Flags section.

philnik accepted this revision.Jan 16 2023, 10:35 AM

LGTM from the libc++ side of things % nit. I think @aaron.ballman should take another look at the Clang changes.

libcxx/utils/generate_header_tests.py
22

A TODO LLVM17: simplify this to __cplusplus >= 202002L would be nice.

This revision is now accepted and ready to land.Jan 16 2023, 10:35 AM
ChuanqiXu updated this revision to Diff 489665.Jan 16 2023, 6:23 PM

Address comments and refine the wording from "use -std=c++20" to "use -std=c++20 or higher".

aaron.ballman accepted this revision.Jan 17 2023, 6:50 AM

LGTM, thank you!

This revision was landed with ongoing or failed builds.Jan 17 2023, 6:27 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 6:27 PM