Skip to content

[libcxx] don't #include <cwchar> if wide chars aren't enabled #99911

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

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions libcxx/include/format
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,21 @@ namespace std {
# include <cstdint>
# include <cstdlib>
# include <cstring>
# include <cwchar>
# include <initializer_list>
# include <limits>
# include <locale>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The commit message doesn't say anything about why you've also made the includes of <locale>, <queue> and <stack> unconditional. Was that change included in this patch by mistake? If it was on purpose, could you update the commit message to explain why it's related or necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're not making them unconditional. If you expand this window to see the lines above, you'll see that the exact same conditional guards the includes above.

I merged the two sections to make the code clearer.

# include <new>
# include <optional>
# include <queue>
# include <stack>
# include <stdexcept>
# include <string>
# include <string_view>
# include <tuple>
#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Copy link
Contributor

@Stylie777 Stylie777 Jul 23, 2024

Choose a reason for hiding this comment

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

Why are we changing the behaviour here? This PR is protecting the include for cwchar, I think this needs to be done in a separate commit/PR if this is not related. If it is, can there be an explanation as to why in the commit message?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're not changing the behaviour. If you expand this window to see the lines above, you'll see that the exact same conditional guards the includes above.

I merged the two sections to make the code clearer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can that be made clearer in the commit message?

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 – if two of us misread the patch in the same way, then I think it's likely that future readers would benefit from the clarification!

Copy link
Member Author

Choose a reason for hiding this comment

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

As I think we'll loose or bury this convo if I force-push, I've updated the description in my automated first comment in this thread. I'll update the description when I merge it. Unless there's a better way to handle this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no idea whether that will do what you want, so good luck with getting the right version of the commit message into the final commit!

Copy link
Contributor

Choose a reason for hiding this comment

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

If you force-push over the current commit it should keep this conversation, not sure GitHub will delete it.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, let me give it a shot now that I've got approval.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah that did work. Googling says comments don't disappear if the lines they're on don't change. Seems like they do still disappear if the lines change: https://github.com/orgs/community/discussions/3478.

# include <locale>
# include <queue>
# include <stack>
# if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
# include <cwchar>
# endif
#endif

#endif // _LIBCPP_FORMAT
Loading