On 13.09.2019 03:51, Roy Marples wrote:
> On 12/09/2019 20:55, Joerg Sonnenberger wrote:
>> On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote:
>>> On 11/09/2019 20:03, Robert Elz wrote:
>>>> Date: Wed, 11 Sep 2019 17:02:53 +0000
>>>> From: "Kamil Rytarowski" <kamil%netbsd.org@localhost>
>>>> Message-ID: <20190911170253.D097FFBF4%cvs.NetBSD.org@localhost>
>>>>
>>>> | Free it when no longer used, just before the program termination.
>>>>
>>>> Can we please avoid this kind of nonsense. Everything is freed when
>>>> every program exits - doing explicit free() calls makes the program
>>>> bigger
>>>> and slower for no reason at all.
>>>>
>>>> By all means fix places where memory is truly leaked (whenre more is
>>>> continuously allocated, and simply discarded) but anything that is
>>>> supposed
>>>> to remain until program exit should simply go away when the exit
>>>> happens.
>>>>
>>>> If the canitisers cannot be instructed to ignore such things, they are
>>>> much less useful tan they could be.
>>>
>>> Could we add an #ifdef for this?
>>>
>>> #ifdef __SANITISATION
>>> free(foo);
>>> close(bar);
>>> #endif
>>>
>>> return EXIT_SUCCESS;
>>
>> That's kind of how coverity and valgrind dealt with it.
>
> Do you happen to know if one #define fits all and if not, can we add it
> to sys/cdefs.h?
>
> Roy
Coverity needs:
#ifdef __COVERITY__
Valgrind doesn't have any checks, it instruments prebuilt programs.
We could add:
#ifndef __has_feature
#define __has_feature 0
#endif
#if defined(__COVERITY__) || __has_feature(address_sanitizer) \
|| defined(__SANITIZE_ADDRESS__)
#define __NO_LEAKS
#endif
Attachment:
signature.asc
Description: OpenPGP digital signature