_FORTIFY_SOURCE for std::vector

Paolo Carlini paolo.carlini@oracle.com
Fri Jun 1 13:11:00 GMT 2012


Hi,

On 06/01/2012 02:53 PM, Florian Weimer wrote:
> I've seen the variable, but I don't understand how to use it.  I would 
> like to add something about it to the testing documentation.
Just copy what *all* the other testcase in the library testsuite have, 
just define it, with attribute unused. If you are curious why, just look 
inside testsuite_hooks.h
> 3- We definitely need a comment explaining *who* provided _M_range_check
>
> Sorry, I don't understand this suggestion.
You are right, sorry, I went through your changes too quickly and didn't 
realize that you are just using the existing _M_range_check. Anyway, I 
confirm that probably we want something more consistent with debug-mode, 
thus not throwing in this case. Maybe just a __builtin_abort(), I don't 
know. Or adjust the code in c++config to make available a non-trivial 
__glibcxx_assert also when _FORTIFY_SOURCE > 0.

>> 4- Maybe I'm misremembering, sorry in case, but Isn't:
>>
>> #if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
>>
>> the same as:
>>
>> #if _FORTIFY_SOURCE > 0
>>
>> ?
>
> I think you're right, but I'm just copying literally what GNU libc is 
> doing.  I can change it to the shorter version if you want me to.
I think we should yes.

Paolo.



More information about the Libstdc++ mailing list