[PATCH] Use _GLIBCXX_ASSERTIONS as _GLIBCXX_DEBUG light

François Dumont frs.dumont@gmail.com
Thu May 27 17:37:03 GMT 2021


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: 4206 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210527/79409637/attachment.bin>


More information about the Libstdc++ mailing list