-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Conversation
|
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 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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#16613" |
|
Note the annoyance (and errorprone) of not having the spec in same repository as compiler... |
|
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 |
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. |
compiler/src/dmd/cond.d
Outdated
| case "CppRuntime_libcpp": | ||
| case "CppRuntime_libcxx": | ||
| case "CppRuntime_DigitalMars": | ||
| case "CppRuntime_libstdcpp": | ||
| case "CppRuntime_libstdcxx": | ||
| case "CppRuntime_Microsoft": | ||
| case "CppRuntime_Sun": |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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_GcctoCppRuntime_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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
ea3e2ac
to
988f31a
Compare
|
I've changed the naming to |
|
Let's go with this, as it's an improvement over the current. |
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>
Rename CppRuntime cpp to cxx
Also accept c++ for cxx in target string.
addresses comment #16610 (review)