10000 Avoid TU-local entities by masterleinad · Pull Request #413 · kokkos/mdspan · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Avoid TU-local entities #413

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

Open
wants to merge 3 commits into
base: stable
Choose a base branch
from

Conversation

masterleinad
Copy link
Contributor
@masterleinad masterleinad commented Jun 12, 2025

Related to kokkos/kokkos#8117. While trying to build a C++20 module for Kokkos with g++-15, I ran into a couple of instances where TU-local entities (https://en.cppreference.com/w/cpp/language/tu_local.html, https://eel.is/c++draft/basic.link#14) are exposed. This pull request tries to fix those I was able to address.
Note that clang++ is much more lenient with TU-local entities as decribed at https://clang.llvm.org/docs/StandardCPlusPlusModules.html#using-tu-local-entity-in-other-units.

  • anonymous structs are TU-local even if the respective variable is declared inline.
  • anonymous namespaces create TU-local symbols
  • It's not quite clear to me why compute_s_static_layout_left and compute_s_static_layout_right were considered TU-local but converting those structs to functions seems be an improvement (since it's more concise) anyway.

It's not quite clear to me which clang-format version was used for these files before so I kept the indentation fixes with clang-16 in a separate commit.

@masterleinad
Copy link
Contributor Author

#285 (comment) suggests that the code was never formatted with clang-format although there are some clang-format comments in the code. Let me just drop the last commit.

Signed-off-by: Daniel Arndt <arndtd@ornl.gov>
@masterleinad masterleinad marked this pull request as ready for review June 12, 2025 15:39
@nmm0
Copy link
Contributor
nmm0 commented Jun 12, 2025

#285 (comment) suggests that the code was never formatted with clang-format although there are some clang-format comments in the code. Let me just drop the last commit.

yeah at some point we need to run the repo through clang-format and add a check to enforce it

@masterleinad
Copy link
Contributor Author

yeah at some point we need to run the repo through clang-format and add a check to enforce it

I'm happy to open a pull request if you're fine with doing it now.

Copy link
Contributor
@nmm0 nmm0 left a comment

Choose a reason for hiding this comment

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

A couple of minor suggestions

@nmm0
Copy link
Contributor
nmm0 commented Jun 12, 2025

yeah at some point we need to run the repo through clang-format and add a check to enforce it

I'm happy to open a pull request if you're fine with doing it now.

That would be really helpful if you have the time!

masterleinad and others added 2 commits June 12, 2025 12:38
Co-authored-by: Nicolas Morales <nmmoral@sandia.gov>
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
0