Commit Graph

1193 Commits

Author SHA1 Message Date
Chris Needham
0e19bdf50a Documentation fixes 2017-09-07 22:56:54 +01:00
Daniel James
f72b0353d4 Shuffle code around for readability
The new indentation made some of the code difficult to read, especially
where macros were concerned, so move things around and add more explicit
namespace declarations.
2017-06-11 20:55:59 +01:00
Daniel James
0676b4f4ca Change clang format indentation + .editorconfig file 2017-06-11 20:55:59 +01:00
Daniel James
5190a5d7f8 Stop dereferencing pointers to uninitialized memory
It's undefined behaviour. Still happens for piecewise construction
emultation for std::pair, I don't think there's anyway to avoid it.
I had considered using offsetof to get a pointer to a member, but that's
also undefined behaviour when a pair member doesn't have standard
layout. Piecewise construction emulation has other problems anyway.

So, this mostly fixes PR #5.

I also stopped using addressof in self-asssignment checks as operator&
is fine.
2017-06-04 08:47:02 +01:00
Daniel James
7775aa83df Decrease the limit for SunOS workaround
We have tests for 12.5 (5,20,0), and 12.5_next (5,21,0), I think both
are good enough to not require workarounds.
2017-05-25 08:53:34 +01:00
Daniel James
fc1604f2c8 Don't use allocator_traits::construct on GCC 4.6
Piecewise construction doesn't work uncopyable types.
2017-05-19 17:24:44 +01:00
Daniel James
5b97fbc292 Make insert from node_handle move only on old GCC 2017-05-19 09:42:56 +01:00
Daniel James
4f5a2dabe9 Try to fix std::tuple on old Sun compilers
In order to use the workaround for both `boost::tuple` and `std::tuple`
the function would need to detect which was being used, in order to
decide whether to use `boost::tuples::length` or `std::tuple_size`.
Probably not difficult, but I don't have any way to test an
implementation.

So instead Just assume that if `std::tuple` is available it will work
without any workaround. Presumably once the compiler was able to support
`std::tuple` it will also support the necessary overloads.

I've left the version check as 5.21 so that failures will still show up
in the tests, but I'm sure it can be 5.20 and probably earlier.  Will
change before release.
2017-05-19 09:03:08 +01:00
Daniel James
e0227618bb Move a few things around to match the order in the standard 2017-05-17 16:47:57 +01:00
Daniel James
ee9a5a2c77 Add a configuration macro for Sun C++ workarounds 2017-05-16 19:01:50 +01:00
Daniel James
6fffc738f7 Require std::tuple for full C++11 construction 2017-05-16 18:15:56 +01:00
Daniel James
dc611fc828 Run fewer test in merge_exception_tests
It's timing out on some platforms because it's too slow. This reduces
the tag combinations for 9 to 3, which should reduce the execution time
by a third. Also slightly reduces the count combinations, but that won't
make much of a difference really - the slowest tests are still there
(when the right hand side is large).
2017-05-14 02:59:22 +01:00
Daniel James
12ee29579d Don't use full construction on Sun C++ w. libstdc++
There's an exception safety issue. Which is a pity as other than that it
seems fine. I'd assumed that support would be pretty good on all C++11
compilers, so I made it an 'all or nothing' feature, partly because
there are issues with pre-C++11 allocators, but this suggests partial
support might be desirable. Not sure I'll be able to (or want to) put
the time in though.
2017-05-12 21:58:52 +01:00
Daniel James
a897843f6c Try to work around an MSVC bug
Although, perhaps I shouldn't be generating over 1000 runs for a test.
2017-05-11 00:36:31 +01:00
Daniel James
80de85f217 Move test state + functions into single class 2017-05-10 19:02:47 +01:00
Daniel James
242e91a9fd "Sub-test" reporting mechanism 2017-05-10 19:02:47 +01:00
Daniel James
ca80237191 Create fewer classes in merge_exception_tests
Will need better error reporting capabilities. Makes RUN_TESTS_QUIET
redundant?
2017-05-10 19:02:47 +01:00
Daniel James
b95ef6de04 Generate less output in merge_exception_tests 2017-05-10 19:02:47 +01:00
Daniel James
76e7322262 Use streams from lightweight test 2017-05-10 19:02:47 +01:00
Daniel James
3c42138e45 Fix testing piecewise_construct and tuple
For when std::piecewise_construct is available, but std::tuple isn't. In
order to test better, just repeat the tests with the four possible
combinations.
2017-05-08 18:42:53 +01:00
Daniel James
1b0b38a519 try_emplace, insert_or_assign exception tests 2017-05-07 18:47:59 +01:00
Daniel James
9119a42b7d Factor insert_exception_tests for better code reuse 2017-05-07 18:47:24 +01:00
Daniel James
8af4b37d14 Rewrite insert exception tests
Not going to do this for all the tests. It's more effort than I
expected.
2017-05-07 17:54:34 +01:00
Daniel James
31c5b5bfa1 Merge exception tests 2017-05-07 17:54:34 +01:00
Daniel James
b6c6bfbe7f Statically handle 'is_unique' in assignments 2017-05-06 04:58:57 +01:00
Daniel James
6e074d7165 Get rid of delete_nodes 2017-05-06 04:58:57 +01:00
Daniel James
0489069419 Use 'limited_range' to catch error in exception tests
This would have caught the error fixed in 3fe259a79e.
2017-05-06 04:47:59 +01:00
Daniel James
597eb5a3fd Repeat the assign/insert exception tests a few times 2017-05-06 04:47:59 +01:00
Daniel James
3fe259a79e Fix creating exception::less from exception::equal_to 2017-05-05 12:58:26 +01:00
Daniel James
6ef17a0f0e Remember to disable exceptions before checking final value 2017-05-05 00:46:07 +01:00
Daniel James
47a8c3fc67 Fix exception handling in rehash_impl
And improve tests so they will catch the error, and other similar errors.
2017-05-04 19:30:18 +01:00
Daniel James
d49d0e90a8 Delete nodes directly instead of through previous node 2017-05-04 00:14:08 +01:00
Daniel James
77bd45b1fa Make second parameter of delete_nodes a node_pointer 2017-05-04 00:14:05 +01:00
Daniel James
622dff50df Fix some code that could be using next_node 2017-05-03 23:36:09 +01:00
Daniel James
41f6a051ef Some more configuration comments 2017-05-03 04:21:53 +01:00
Daniel James
d05619095c Workaround problems with forward_as_tuple in older versions of clang 2017-05-03 04:21:52 +01:00
Daniel James
2f8492d720 Fix libc++ configuration 2017-05-03 04:21:52 +01:00
Daniel James
7911f491f6 Try using own allocator_traits with Sun compiler
The good news is that the old Sun workarounds aren't needed any more.
Unfortunately, there are a lot of exception test errors for
unordered_map and unordered_multimap when using libstdc++, which
probably means that std::pair isn't exception safe, which is a bit odd.
But first try using our allocator_traits implementation instead of the
standard one to see if that makes a difference. If it doesn't then I'll
probably just disable C++11 construction on this compiler, which should
fix the problem but will make allocators less useful.
2017-05-03 04:21:52 +01:00
Daniel James
d84a57441b Use the unordered container for the fake merge in merge test
The merge tests into containers with unique keys are failing on some
platforms. My guess is that because of differences between ordering of
nodes with equivalent keys that different nodes are being 'merged' in
the unordered containers and the tracker containers. So when creating
the fake merge, use the unordered container as a reference. This is a
little less pure, but should be a good enough test.
2017-05-01 22:16:13 +01:00
Daniel James
b8c754d230 Set the high bit in bucket_info_ to false for first node in group
And true for the reset, so that in containers with unique keys
bucket_info_ is always just the bucket index.
2017-05-01 21:03:11 +01:00
Daniel James
338a94e577 Better rvalue emulation support in extractors
Means that inserting rvalues into unordered_set/unordered_map won't
create a node if no insert is required.
2017-05-01 21:03:11 +01:00
Daniel James
2e14c340a8 Reformat 2017-05-01 21:03:11 +01:00
Daniel James
35522d3ee0 Fix merging between containers with different hash/equality
This reverts commit 20b0c0a6d8.
2017-04-30 14:29:05 +01:00
Daniel James
8c139940e7 More merge tests between compatible containers 2017-04-30 14:29:05 +01:00
Daniel James
7b5f73f6c2 Disable all sunpro workarounds on latest version
I have no idea if they're still working. I wasn't able to run the latest
solaris in a virtual machine on my computer, so this is the only way to
test.
2017-04-30 10:44:54 +01:00
Daniel James
e7a3487df4 Remove policy template parameter from local iterators 2017-04-30 10:44:54 +01:00
Daniel James
c243895fc0 Remove odd check that should never be true
I think it was left over from the old grouped node implementation.
2017-04-30 10:44:54 +01:00
Daniel James
451d0f2fc5 Constructing nodes is nothrow, so no need to track 2017-04-30 10:43:06 +01:00
Daniel James
c75b332240 Cleaner create_buckets implementation 2017-04-30 10:43:06 +01:00
Daniel James
899248acbf Avoid shadow warning on older versions off GCC 2017-04-29 09:31:17 +01:00