This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Add TEST_STACK_ALLOCATOR_WORKAROUND.
AbandonedPublic

Authored by STL_MSFT on Jul 29 2016, 1:04 PM.

Details

Reviewers
mclow.lists
Summary

Add TEST_STACK_ALLOCATOR_WORKAROUND. As I reported to Eric and Marshall:

"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].

First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)

Second, it lacks templated equality/inequality.

Third, it completely ignores alignment.

Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

I would like to be able to run libcxx's tests without any local patches (I can inject macros etc. via a force-included header in a separate directory). I'm down to one local patch dealing with stack_allocator. Adding this workaround macro will allow me to consume libcxx's tests unchanged.

Diff Detail

Event Timeline

STL_MSFT updated this revision to Diff 66164.Jul 29 2016, 1:04 PM
STL_MSFT retitled this revision from to [libcxx] [test] Add TEST_STACK_ALLOCATOR_WORKAROUND..
STL_MSFT updated this object.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

I know that this stack_allocator issue is a huge headache, but would it be possible to accept this small, non-intrusive diff upstream? This is the last local change that I have.

EricWF accepted this revision.Sep 30 2016, 7:57 PM
EricWF edited edge metadata.

I'm OK accepting this, but I'm going to weak it before committing so that test_macros.h define TEST_STACK_ALLOCATOR_WORKAROUND for non-libc++ builds.

This revision is now accepted and ready to land.Sep 30 2016, 7:57 PM
EricWF requested changes to this revision.Oct 1 2016, 1:57 AM
EricWF edited edge metadata.

Nevermind. I decided to just fix stack_allocator so this patch is no longer needed. Please let me know if the stack allocator fix doesn't work

This revision now requires changes to proceed.Oct 1 2016, 1:57 AM
EricWF resigned from this revision.Oct 1 2016, 1:57 AM
EricWF removed a reviewer: EricWF.
STL_MSFT abandoned this revision.Oct 10 2016, 1:43 PM

Abandoning, as this machinery has been replaced.