[PATCH] Use _GLIBCXX_ASSERTIONS as _GLIBCXX_DEBUG light
François Dumont
frs.dumont@gmail.com
Mon May 31 17:17:30 GMT 2021
Completing the tests revealed that this patch was missing a small change
in include/bits/stl_iterator.h. Here is the updated patch.
libstdc++: [_GLIBCXX_ASSERTIONS] Activate basic debug checks
Use _GLIBCXX_ASSERTIONS as a _GLIBCXX_DEBUG light mode. When
defined it activates
all _GLIBCXX_DEBUG checks but skipping those requiring to loop
through the iterator
range unless in case of constexpr.
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator.h [_GLIBCXX_ASSERTIONS]:
Include <debug/stl_iterator.h>.
* include/debug/debug.h [_GLIBCXX_ASSERTIONS]: Define debug
macros non-empty.
* include/debug/helper_functions.h: Cleanup comment about
removed _Iter_base.
* include/debug/functions.h (__skip_debug_runtime_check):
New, returns false if
_GLIBCXX_DEBUG is defined or if constant evaluated.
(__check_sorted, __check_partitioned_lower,
__check_partitioned_upper): Use latter.
Ok to commit ?
François
On 27/05/21 7:37 pm, François Dumont wrote:
> We have been talking for a long time of a debug mode with less impact
> on performances.
>
> I propose to simply use the existing _GLIBCXX_ASSERTIONS macro.
>
> libstdc++: [_GLIBCXX_ASSERTIONS] Activate basic debug checks
>
> Use _GLIBCXX_ASSERTIONS as a _GLIBCXX_DEBUG light mode. When
> defined it activates
> all _GLIBCXX_DEBUG checks but skipping those requiring to loop
> through the iterator
> range unless in case of constexpr.
>
> libstdc++-v3/ChangeLog:
>
> * include/debug/debug.h [_GLIBCXX_ASSERTIONS]: Define
> debug macros non-empty.
> * include/debug/helper_functions.h: Cleanup comment about
> removed _Iter_base.
> * include/debug/functions.h (__skip_debug_runtime_check):
> New, returns false if
> _GLIBCXX_DEBUG is defined or if constant evaluated.
> (__check_sorted, __check_partitioned_lower,
> __check_partitioned_upper): Use latter.
>
> Tested under Linux x64.
>
> Ok to commit ?
>
> François
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: assertion_mode.patch
Type: text/x-patch
Size: 4634 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210531/31f395c8/attachment.bin>
More information about the Libstdc++
mailing list