Container debug light mode

François Dumont frs.dumont@gmail.com
Thu Jun 16 19:28:00 GMT 2016


And here is the patch to only add light debug checks to vector and deque.

     * include/debug/debug.h
     (__glibcxx_requires_non_empty_range, __glibcxx_requires_nonempty)
     (__glibcxx_requires_subscript): Move...
     * include/debug/assertions.h: ...here and add __builtin_expect.
     (_GLIBCXX_DEBUG_ONLY): Remove ; value.
     * include/bits/stl_deque.h
     (std::deque<>::operator[]): Add __glibcxx_requires_subscript check.
     (std::deque<>::front()): Add __glibcxx_requires_nonempty check.
     (std::deque<>::back()): Likewise.
     (std::deque<>::pop_front()): Likewise.
     (std::deque<>::pop_back()): Likewise.
     (std::deque<>::swap(deque&)): Add allocator check.
     * include/bits/stl_vector.h
     (std::vector<>::operator[]): Add __glibcxx_requires_subscript check.
     (std::vector<>::front()): Add __glibcxx_requires_nonempty check.
     (std::vector<>::back()): Likewise.
     (std::vector<>::pop_back()): Likewise.
     (std::vector<>::swap(vector&)): Add allocator check.

Tested under Linux x86_64.

François

On 13/06/2016 12:21, Jonathan Wakely wrote:
> On 08/06/16 22:53 +0200, François Dumont wrote:
>> Hi
>>
>>    Here is the patch I already proposed to introduce the debug light 
>> mode for vector and deque containers.
>>
>>    It also simplify some internal calls.
>
> This looks great, and I'd like to see it on trunk, but could you split
> it into two patches please? The simplifications to use
> __iterator_category and replace insert() with _M_insert_* are good but
> are unrelated to the debug mode parts so if there are two separate
> commits it's easier to backport one piece separately, or to identify
> any regressions that might be introduced.
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cont_debug_light.patch
Type: text/x-patch
Size: 10583 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160616/08177ffe/attachment.bin>


More information about the Libstdc++ mailing list