debug algo patch
François Dumont
francois.cppdevs@free.fr
Tue May 24 19:48:00 GMT 2011
Hi
Here is an evolution in management of debug algos I would like to
propose for a future version. The attached patch does 3 things:
- Move algos implementation details in std::__detail namespace so
that whatever mode (none/debug/profile/parallel) is activated those
details will always be found in the same namespace
- Introduce real debug algos in std::__debug namespace
- Generalize usage of __gnu_debug::__safe method that limit
performance impact of debug mode
I hope this patch to:
- Clean code: debug stuff will be isolated in include/debug folder
and won't pollute anymore normal implementations in include/bits. This
is especially important with the introduction of calls to
__gnu_debug::__base
- Optimize debug performances because for the moment some debug
algos or containers might have been calling internally other debug algos
without knowing it and performing useless checks.
For the moment this patch doesn't work in debug mode because of
ambiguity when resolving algo calls as soon as debug containers are
involved; std::__debug is considered thanks to namespace inlinement and
std::__cxx1998 is considered because of ADL as debug containers are
inheriting from normal ones that are in __cxx1998 namespace. I have plan
to remove this inheritance relation if the patch suite you well.
I have also restore the possibility to use both parallel and debug
mode at the same time, I don't think there were a real reason to have
remove this possibility. Note that when both modes are active we could
also offer debug version of parallel specific algos, maybe one day.
In debug code I use a _GLIBCXX_BASE_A to define the base namespace
to target to find underlying algos implementation. In normal mode you
will see usage of _GLIBCXX_PARALLEL_A. I am not happy with this name
because in fact it might not be a parallel algo at all, when parallel
mode is not active it will be the normal algo. I simply wanted to
explicitly avoid usage of the debug algos, it will have to be enhance
for the final patch.
Note also that we could also got a step further in seggregation of
code by moving concept checks outside normal algos implementation. We
could have all algos defined directly into std namespace and then have
an internal namespace with __debug, __parallel, __profile in it and one
inlined depending on activated mode. This would have the advantage of:
- always consider concept checks first, so consistent error reporting
whatever mode is activated or not
- avoid concept checks on internal algos usage
I am considering to start the SVN binary incompatible branch with
this patch as soon as it works.
Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_algos.patch
Type: text/x-patch
Size: 256223 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20110524/5f107329/attachment.bin>
More information about the Libstdc++
mailing list