Skip to content

[DRAFT][libc++][modules] Improves std.compat module. #74945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

mordante
Copy link
Member

@mordante mordante commented Dec 9, 2023

Based on @ChuanqiXu9's suggestion in #71438.

Copy link

github-actions bot commented Dec 9, 2023

⚠️ Python code formatter, darker found issues in your code. ⚠️

You can test this locally with the following command:
darker --check --diff -r cd6e462d012f289cc4ec12927ca8198f9ed1469e...755d04c9279b197ee93e97d4c3c84ea8cc4eb25a libcxx/utils/generate_libcxx_cppm_in.py
View the diff from darker here.
--- generate_libcxx_cppm_in.py	2023-12-10 11:54:32.000000 +0000
+++ generate_libcxx_cppm_in.py	2023-12-10 11:56:56.308250 +0000
@@ -13,11 +13,10 @@
 from libcxx.header_information import header_restrictions
 from libcxx.header_information import headers_not_available
 
 
 def write_file(module):
-
     # TODO REMOVE THIS HACK, WE NEED A BETTER WAY TO DETECT C HEADERS
     Module_headers = (
         module_headers
         if module == "std"
         else [

Copy link
Member

@ChuanqiXu9 ChuanqiXu9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick action.

I am wondering if we can make this better to remove the duplicated includes completely (like ).

For example, is it valid to do the following:

export module std.compat;
export import std;

export using double_t = std::double_t;

@mordante
Copy link
Member Author

Probably we can. For now I was mainly focusing on getting export import std; to work properly, which it doesn't.
Once I have that working I want to polish the code further.

@mordante mordante force-pushed the GH-improves_std.compat_module branch from b4031b7 to 755d04c Compare December 10, 2023 11:54
@mordante
Copy link
Member Author

This patch is on hold. There are issues to get this working in our build infrastructure. For unrelated reasons to this patch there are some improvements I want to make in the infrastructure. I expect that that solves my issues with this patch too.

@ChuanqiXu9
Copy link
Member

This patch is on hold. There are issues to get this working in our build infrastructure. For unrelated reasons to this patch there are some improvements I want to make in the infrastructure. I expect that that solves my issues with this patch too.

Got it. I was curious why it is problematic since I thought the cmake should handle that well.

But if we can't land this before the branching of 18, I'll strongly suggest to not ship the std.compat module since this patch is essential to the usability of std.compat module.

@mordante
Copy link
Member Author

This patch is on hold. There are issues to get this working in our build infrastructure. For unrelated reasons to this patch there are some improvements I want to make in the infrastructure. I expect that that solves my issues with this patch too.

Got it. I was curious why it is problematic since I thought the cmake should handle that well.

I expected that too, but it didn't. The other issue is the test infrastructure using CMake is problematic for several reasons. The main reason to use CMake was the module partition per header. Since we changed that design we only have 2 modules to build. This can be done manually. The proof-of-concept I have removes about 200 lines of code and removes the CMake 3.26 requirement to test modules with libc++. (Users still need a new CMake when they want to use modules.)

But if we can't land this before the branching of 18, I'll strongly suggest to not ship the std.compat module since this patch is essential to the usability of std.compat module.

I'm not sure that's a good idea. However I expect to finish the code part next week. Due to holidays it might take a bit longer than usual to land.

@ChuanqiXu9
Copy link
Member

I expected that too, but it didn't.

If I read correctly, do you mean there is a problem in cmake to handle the dependencies? If yes, we need to report that to cmake.

But if we can't land this before the branching of 18, I'll strongly suggest to not ship the std.compat module since this patch is essential to the usability of std.compat module.

I'm not sure that's a good idea. However I expect to finish the code part next week. Due to holidays it might take a bit longer than usual to land.

Yeah, it is not hurry since we still have one month from that. And in case we can't make it, it shouldn't be a bad idea to not ship std.compat module only since I think std module should work in most cases.

@mordante
Copy link
Member Author

I expected that too, but it didn't.

If I read correctly, do you mean there is a problem in cmake to handle the dependencies? If yes, we need to report that to cmake.

I'm not sure whether it's a cmake issue. I do some manual dependency management. So it might be my code that's wrong. This code is quite "old". It was written when cmake and clang-scan-deps was still under heavy development. I never cleaned it up. Doing that was originally the plan to do in this PR, but I switched to a different approach.

@mordante
Copy link
Member Author

I've created a stacked review for multiple module changes. Since this was not part of a stacked review I've created a new PR #76330.

@mordante mordante closed this Dec 24, 2023
@mordante mordante deleted the GH-improves_std.compat_module branch December 24, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants