[cfe-commits] [cfe-dev] How to fix null-deref-ps.c on FreeBSD?

Ted Kremenek kremenek at apple.com
Tue Feb 17 09:52:04 PST 2009


On Feb 17, 2009, at 9:49 AM, Ben Laurie wrote:

>> Hi Ben,
>>
>> The analyzer knows that all functions with the 'noreturn' attribute  
>> don't
>>
>> return.  What does the assert macro expand to on FreeBSD?
>>
>> The problem is that __assert does not have noreturn set on FreeBSD.
>> I'm in the process of getting that fixed - but as an apprentice
>> FreeBSD committer that's probably harder for me than anyone else, so
>> it may take a while :-)
>>
>> In the meantime, I think the right answer is for me to patch
>> /usr/include/assert.h.
>>
>> __assert isn't the only "panic" function that isn't marked with  
>> noreturn.
>> Since it occurs so frequently, I can just add it to the list of  
>> hard-coded
>> functions that the analyzer knows about.
>
> I wondered if such a thing existed. Where is it?

It's this hackish blob of code in GRExprEngine.cpp.  Search for  
"panic".  Eventually this code will get reworked to be less hackish,  
but we will always have to maintain a list of some of these functions  
somewhere.

I just added "_assert" to that list:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090216/012556.html

It joins the ranks of functions such as _assert_rtn, _assert_fail,  
dtrace_assfail and friends.



More information about the cfe-commits mailing list