Enhance __gnu_debug::string debug assertion

François Dumont frs.dumont@gmail.com
Thu Jul 5 05:28:00 GMT 2018


     This patch improves the assertion message generated in 2 
__gnu_debug::string constructors giving the assertion context thanks to 
the __FUNCTION__ macro.

Was:

/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/string:56: 
const _CharT* __gnu_debug::__check_string(const _CharT*, _Integer, const 
char*, unsigned int, const char*) [with _CharT = char; _Integer = long 
unsigned int]: Assertion '__s != 0 || __n == 0' failed.
XFAIL: 21_strings/basic_string/debug/1_neg.cc execution test

Now:

/home/fdt/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/string:172:
In function:
     __gnu_debug::basic_string<_CharT, _Traits,
     _Allocator>::basic_string(const _CharT*,
     __gnu_debug::basic_string<_CharT, _Traits, _Allocator>::size_type, 
const
     _Allocator&) [with _CharT = char; _Traits = std::char_traits<char>;
     _Allocator = std::allocator<char>; __gnu_debug::basic_string<_CharT,
     _Traits, _Allocator>::size_type = long unsigned int]

Error: __s != 0 || __n == 0.
XFAIL: 21_strings/basic_string/debug/1_neg.cc execution test

     Tested under Linux x86_64 normal and debug modes.

     If not told otherwise I plan to commit the attached patch tomorrow.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_string.patch
Type: text/x-patch
Size: 6813 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180705/8debbf74/attachment.bin>


More information about the Libstdc++ mailing list