-
-
Notifications
You must be signed in to change notification settings - Fork 422
Conversation
|
Thanks for your pull request and interest in making D better, @TurkeyMan! 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 referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + druntime#2310" |
1d1d478
to
e5bcd61
Compare
| */ | ||
| extern(C++, class) struct allocator(T) | ||
| { | ||
| static assert(!is(T == const), "The C++ Standard forbids containers of const elements because allocator!(const T) is ill-formed."); |
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.
Should also check for immutable no ?
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.
Sure. What I really care about though, is working out how to run those tests in this pr to prove it works on all those build machines...
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'm pretty sure it does not work on POSIX, because template mangling is broken.
But having those tests running on Windows would be awesome.
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.
We need to run it on every target, then I'd know that template mangling is broken and fix it...
I'm not aware of problems with template mangling. This needs to work everywhere. Can't know that unless ci executes the tests.
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.
immutable should already be caught by the mangling code, because there is no equivalent.
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.
That's right, however the additional check is a small price to pay here. A casual reader might not realize that immutable is disallowed by the compiler. Also, we have no guarantee this won't change in the future. Lastly, it will provide a better error message.
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.
These are all great ideas, but it's all worthless unless we find a way to test it ;)
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.
See TurkeyMan#1. I suspect it will conflict with master due to other added tests, though.
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.
@rainers Thanks! I can't see how the .cpp file gets built in there though, that's the trouble point, since it needs to compile for all targets, and that includes DMC and MSVC on windows...
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 can't see how the
.cppfile gets built in there though, that's the trouble point, since it needs to compile for all targets, and that includes DMC and MSVC on windows...
The amended changes to the makefile now contain the cpp-compilation, but as string.d doesn't compile on anything but win64, the auto-tester stops before it schedules anything to the Windows machines. I'd suggest adding version(CRuntime_Microsoft): at the top for now.
When this works to some extend, adding makefiles for other targets to the test should be straight-forward.
6c100f5
to
bbf803f
Compare
d4877e4
to
e2863a3
Compare
a77324e
to
b3f988e
Compare
src/core/stdcpp/string.d
Outdated
| else version (CppRuntime_Gcc) | ||
| { | ||
| /// | ||
| this(DefaultConstruct) { _M_p = _M_local_data(); _M_set_length(0); } |
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.
@WalterBright @andralex And there it is... GNU's STL keeps an interior pointer in std::string >_<
This is the only STL implementation I've seen so far that does (I've seen a lot now!), but I'm effectively blocked on this here.
How's DIP 1014 coming along? That's probably the only way to move this forward.
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.
If you don't need to support it, I'd say defer adding the CppRuntime_Gcc implementation. Note that because there is no instantiations of the template in druntime, you can probably just static assert(0, "CppRuntime_Gcc not yet supported");
If you do... you'll need to wait until DIP1014 is implemented.
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 tickled my own needs months ago... I don't need to do all this work to make the tests work and hit all platforms ;)
I just want to put the lid on this whole thing... it's gone on way too long.
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.
This is a major problem. AFAIK nobody is working on DIP 1014.
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.
Well, it's sitting on your review queue... is there something wrong with it? Are you planning on rejecting it?
It's literally the thing on your desk right now isn't it? (according to the DIP schedule)
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 assume he means implementation, but it is ambiguous.
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.
DIP 1014 looks simple. I'm sure it'll appear promptly if it's approved.
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 meant internal pointers in std::string are a major problem, and that nobody is working on DIP 1014.
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.
Right, but DIP 1014 is resting with you and Walter is it not? You are the only one that can move that along.
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.
@TurkeyMan DIP 1014 have been recently approved
b3f988e
to
f383e6f
Compare
|
Is mangling issues? |
|
@TurkeyMan it would if you link the C++ std lib to it ;) |
|
Those symbols are all templates... they should have been instantiated by |
|
You're missing a makefile for non-windows platforms so I guess the tester is just recursing into |
|
|
|
Typical, there's exactly one machine in the farm running VS2013, which is very old... so I need to detect and support it. |
|
Lets give this a little bit of testing priority... |
|
I'm rebasing, since the last merge collides. |
|
This is working, the test just depends on getting an environment variable into make >_< |
win64.mak
Outdated
| @@ -108,7 +108,8 @@ test_hash: | |||
| "$(DMD)" -m$(MODEL) -conf= -Isrc -defaultlib=$(DRUNTIME) -run test\hash\src\test_hash.d | |||
|
|
|||
| test_stdcpp: | |||
| "$(MAKE)" -f test\stdcpp\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test | |||
| setmscver.bat | |||
| "$(MAKE)" -f test\stdcpp\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" "_MSC_VER=$(_MSC_VER)" test | |||
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.
This is the CI issue:
setmscver.bat sets the _MSC_VER variable, but then when make executes the next line (make), it seems like the variable is forgotten...
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.
It's not forgotten. You simply execute different processes that fork from the parent environment. Try e.g. &&
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.
child processes should inherit the parent environment?
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 can't find an incantation that works... how are you supposed to do this? I need to set a make variable from a thing that a script determines?
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.
setmscver.bat && "$(MAKE)" "_MSC_VER=%_MSC_VER%" should work.
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.
it doesn't... i tried every conceivable combination of stuff like that I could think of.
I found a solution though.
But there's another problem; I just realised that windows make isn't actually make... It's an incomplete make clone!
It won't let me do ifeq in the makefile... what's that about? How do I set a variable conditionally?
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.
It's Digital Mars make, a very basic make with some surprising behavior. (see https://dlang.org/blog/2018/06/11/dasbetterc-converting-make-c-to-d/)
How do I set a variable conditionally?
I don't think that is possible directly. Depending on the problem invoking make recursively might be part of a solution.
|
ffs, something else took the win64 runner; so we'll have to wait an hour again >_< |
|
It didn't it just took a while to come online. |
|
while our lives slowly drift away... |
|
slowly. |
src/core/stdcpp/allocator.d
Outdated
| if (count == 0) | ||
| return null; | ||
| T* mem; | ||
| if ((size_t.max / T.sizeof < count) || (mem = __cpp_new(count * T.sizeof)) == 0) |
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.
src\core\stdcpp\allocator.d(52): Error: cannot implicitly convert expression `__cpp_new(count * 4LU)` of type `void*` to `int*`
test\stdcpp\src\allocator_test.d(17): Error: template instance `core.stdcpp.allocator.allocator!int` error instantiating
src\core\stdcpp\allocator.d(52): Error: cannot implicitly convert expression `__cpp_new(count * 8LU)` of type `void*` to `double*`
test\stdcpp\src\allocator_test.d(18): Error: template instance `core.stdcpp.allocator.allocator!double` error instantiating
src\core\stdcpp\allocator.d(52): Error: cannot implicitly convert expression `__cpp_new(count * 24LU)` of type `void*` to `MyStruct*`
test\stdcpp\src\allocator_test.d(19): Error: template instance `core.stdcpp.allocator.allocator!(MyStruct)` error instantiating
| if ((size_t.max / T.sizeof < count) || (mem = __cpp_new(count * T.sizeof)) == 0) | |
| if ((size_t.max / T.sizeof < count) || (mem = cast(T*)__cpp_new(count * T.sizeof)) is null) |
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 can see that ;) ... i just had to wait 2 hours to get the error message!
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 can see that ;) ... i just had to wait 2 hours to get the error message!
If you cannot test locally, maybe it would be more productive to setup your own CI on appveyor, you can select an image with VS2013 installed, too (see top of appveyor.xml). You can probably set it up before next iteration here is done...
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 pushed before going to work. if it fails again, i'll do that tonight.
I had no idea appveyor had testers for 2013 still. we should just use it for all windows builds and get rid of the win32 auto-tester machines.
Look at the auto-tester logs; most machines take 5-10 minutes, except the windows machines which take 30-50 miunutes...
|
Done! I don't think those buildkite issues are related to this PR... |
|
Almost 1 year in the making! |
|
Hooolyyy smokes. That happened. |
| @@ -0,0 +1,3 @@ | |||
| Added `core.stdcpp.string`. | |||
|
|
|||
| Added `core.stdcpp.string`, which links against C++ `std::string` | |||
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.
Should have stated that it's only for Windows :/
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.
Good point. I'll update that, or I'll just make the other platforms CI work. (Well, Linux still has the interior point issue...)
This is still WIP, but the MS implementation is fully working and usable.
This is blocked on: