Skip to content
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

Fix bugzilla issue 24623 followup. #16613

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

JohanEngelen
Copy link
Contributor

Rename CppRuntime cpp to cxx
Also accept c++ for cxx in target string.

addresses comment #16610 (review)

@dlang-bot
Copy link
Contributor

dlang-bot commented Jun 22, 2024

Thanks for your pull request and interest in making D better, @JohanEngelen! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
24623 enhancement Rename version CppRuntime_Clang/Gcc to CppRuntime_libcxx/libstdcxx.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + dmd#16613"

JohanEngelen added a commit to JohanEngelen/dlang.org that referenced this pull request Jun 22, 2024
@JohanEngelen
Copy link
Contributor Author

dlang/dlang.org#3853

Note the annoyance (and errorprone) of not having the spec in same repository as compiler...

@Herringway
Copy link
Contributor

isn't this going to cause silent failures in code relying on the old version identifiers? it's too bad a deprecation process isn't possible for them

@JohanEngelen
Copy link
Contributor Author

isn't this going to cause silent failures in code relying on the old version identifiers?

No, because the old ones are still being defined by the compiler.

@Herringway
Copy link
Contributor

isn't this going to cause silent failures in code relying on the old version identifiers?

No, because the old ones are still being defined by the compiler.

That doesn't appear to be true with this PR's changes

@ibuclaw
Copy link
Member

ibuclaw commented Jun 22, 2024

isn't this going to cause silent failures in code relying on the old version identifiers?

No, because the old ones are still being defined by the compiler.

That doesn't appear to be true with this PR's changes

Nothing's been released yet so we're safe until end of the month.

Comment on lines 662 to 666
case "CppRuntime_libcpp":
case "CppRuntime_libcxx":
case "CppRuntime_DigitalMars":
case "CppRuntime_libstdcpp":
case "CppRuntime_libstdcxx":
case "CppRuntime_Microsoft":
case "CppRuntime_Sun":
Copy link
Member

@ibuclaw ibuclaw Jun 22, 2024

Choose a reason for hiding this comment

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

I've given it a bit more thought.

So just to underline something here, we have CppRuntime_...

  • DigitalMars
  • Microsoft
  • Sun
  • libcxx
  • libstdcxx

Whilst I can agree that calling them Clang and Gcc is both vague and misleading (although g++ doesn't work with libc++ AFAIK), I'm not initially convinced they should follow a different style either.

The only alternative I can offer is taking inspiration from their respective documentation pages.

  • libstdc++ titles itself the GNU C++ Library
  • libc++ while it does make a reference to other C++ libraries by vendor - Apache libstdcxx, STLport, ... - it only titles itself as the bland C++ Standard Library. However various package distributors seem to almost universally call it the LLVM C++ Standard Library.

So I'm erring on the side of renaming them CppRuntime_LLVM and CppRuntime_GNU. But happy to be convinced otherwise if there's a compelling reason why explicit library names are the best handles to use.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your proposal is reasonable, I think it's unlike that GNU or LLVM will implement another standard library. Personally, I would not recognize CppRuntime_GNU/LLVM as libstdc++/libc++ as quickly, but it is rare anyway to have to work with this stuff so doesn't really matter.
For -target= recognition, I propose we really do recognize libstdc++/libc++ (and not add gnu/llvm because those are very ambiguous in a triple)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(in the end, I think we do rely on the exact library, not the vendor, that'd be a reason to name the thing by its name)

Copy link
Member

Choose a reason for hiding this comment

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

With the new evidence @ibuclaw provided, I would just err on the side of reverting the initial PR altogether.
I couldn't care less about naming, which is why I was personally okay with your proposal, but will going from CppRuntime_Gcc to CppRuntime_GNU, etc... really make that big of a difference that the change has value ? I don't really think so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't care less about naming

Really?? Naming is a big part of programming (a key reason why DMD source is hard to understand and actively avoided by me).

but will going from CppRuntime_Gcc to CppRuntime_GNU, etc... really make that big of a difference that the change has value ?

Yes. The current naming is factually incorrect and hurts legibility of druntime code.

If you don't care about naming, then you also don't have an argument against changing the names, I guess?

Copy link
Member

@ibuclaw ibuclaw Jun 23, 2024

Choose a reason for hiding this comment

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

Personally, I would not recognize CppRuntime_GNU/LLVM as libstdc++/libc++ as quickly

Though it's not our problem, it's libc++ for the Standard C++ library, then there's libstdc++ for the GNU C++ library - a misleading std. :-)

Whichever way we go, my own preference is to keep the version identifiers consistent if at all possible, so either we have:

  • CppRuntime_DigitalMars
  • CppRuntime_Microsoft
  • CppRuntime_Sun
  • CppRuntime_LLVM (or Llvm/llvm)
  • CppRuntime_GNU (or Gnu/gnu)

or it is...

  • CppRuntime_snn (guessing here)
  • CppRuntime_msvc
  • CppRuntime_libCstd
  • CppRuntime_libcxx
  • CppRuntime_libstdcxx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tradeoff table:

        | ..._DigitalMars | ..._DigitalMars | ..._snn       | ..._DigitalMars_snn
        | ..._Microsoft   | ..._Microsoft   | ..._msvc      | ..._Microsoft_msvc
        | ..._Sun         | ..._Sun         | ..._libCstd   | ..._Sun_libCstd
        | ..._Clang       | ..._LLVM        | ..._libcxx    | ..._LLVM_libcxx
        | ..._Gcc         | ..._GNU         | ..._libstdcxx | ..._GNU_libstdcxx
--------|-----------------|-----------------|---------------|---------------------
Clarity |  4              |  7              |  6            |     10
# change|  0              |  2              |  5 (all)      |    5 (all)
backw   |  n/a            | Keep 2 old ones | Keep 5 old?   | Keep 5 old?
compat? |                 |                 |               |
Remark  | incorrect       | assume 1 lib    |               | too verbose?
        |                 | per vendor      |               |

minus 1 for clarity of the lib names, because of less known Sun and DM lib names.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. The current naming is factually incorrect and hurts legibility of druntime code.

But the new names hurts readability for (some) people that develop projects outside of DRuntime, which I would hope is most people! Because when you are linking against C++ source code, you know what compiler you use, and so Clang / Gcc are helpful in that regard. For people only linking, I understand the situation may be different.

If you don't care about naming, then you also don't have an argument against changing the names, I guess?

In this instance, since neither name is completely wrong (IMO, I know you disagree on that point), I care about the amount of change. And I don't think the change from one to the other is materially better. Other people's mileage may vary.

or it is...

  • CppRuntime_snn (guessing here)
  • CppRuntime_msvc
  • CppRuntime_libCstd
  • CppRuntime_libcxx
  • CppRuntime_libstdcxx

That, on the other hand, would be pretty bad.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The current naming is factually incorrect and hurts legibility of druntime code.

But the new names hurts readability for (some) people that develop projects outside of DRuntime, which I would hope is most people! Because when you are linking against C++ source code, you know what compiler you use, and so Clang / Gcc are helpful in that regard.

This is exactly what is wrong about it!
Let's say you are using Clang, what CppRuntime_* do you most likely need do you think? Hint: it is CppRuntime_Gcc.

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I would not recognize CppRuntime_GNU/LLVM as libstdc++/libc++ as quickly, but it is rare anyway to have to work with this stuff so doesn't really matter.

WRT one library per vendor, more likely there would be different versions - for example GNU's library is specifically libstdc++v3; v2 was pre-GCC 3.x.

For -target= recognition, I propose we really do recognize libstdc++/libc++ (and not add gnu/llvm because those are very ambiguous in a triple)

Agreed.

Rename CppRuntime to _LLVM and _GNU
Also accept c++ for cxx in target string.
@JohanEngelen
Copy link
Contributor Author

I've changed the naming to
CppRuntime_DigitalMars
CppRuntime_Microsoft
CppRuntime_Sun
CppRuntime_LLVM
CppRuntime_GNU

@ibuclaw
Copy link
Member

ibuclaw commented Jun 30, 2024

Let's go with this, as it's an improvement over the current.

@dlang-bot dlang-bot merged commit b5130fd into dlang:master Jun 30, 2024
41 checks passed
@JohanEngelen JohanEngelen deleted the cppruntime_rename2 branch June 30, 2024 13:33
dlang-bot pushed a commit to dlang/dlang.org that referenced this pull request Jun 30, 2024
Version identifier cpp -> LLVM/GNU, see dlang/dmd#16613

Signed-off-by: Iain Buclaw <ibuclaw@users.noreply.github.com>
Merged-on-behalf-of: Iain Buclaw <ibuclaw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants