Re: V668 lint errors

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: V668 lint errors

Rik-4
On 01/01/2019 06:15 PM, [hidden email] wrote:
Subject:
Re: Lint checking Octave
From:
Andreas Weber [hidden email]
Date:
01/01/2019 10:10 AM
To:
[hidden email]
List-Post:
[hidden email]
Content-Transfer-Encoding:
quoted-printable
Precedence:
list
MIME-Version:
1.0
References:
<MTAwMDA0OC5ub21hZA.1546287050@quikprotect>
In-Reply-To:
<MTAwMDA0OC5ub21hZA.1546287050@quikprotect>
Message-ID:
[hidden email]
Content-Type:
text/plain; charset=utf-8; format=flowed
Message:
3

Am 31.12.18 um 21:10 schrieb Rik:
dismissed.  I have created a page to track the status of this at
https://wiki.octave.org/PVS_static_analyzer_-_5.0_Release.  The original
bug report is at https://savannah.gnu.org/bugs/?55347.


There are many of V668 "There is no sense in testing the pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error."

Should we remove all of them (with one commit)?

-- Andy

Here is an example of code which triggers the V668 message from display.cc.

--- Code Start ---
        instance = new display_info (query);

        if (instance)
          singleton_cleanup_list::add (cleanup_instance);
--- Code End ---

In this case, it seems pretty clear that we could eliminate the test on "instance".

For the general case, I'm not so sure.

@jwe: Are there any cases you can think of where we might disable exceptions or do something odd where it would not be okay to remove a check for a nullptr?

--Rik
Reply | Threaded
Open this post in threaded view
|

Re: V668 lint errors

Andreas Weber-6
Am 02.01.19 um 04:27 schrieb Rik:
> For the general case, I'm not so sure.
>
> @jwe: Are there any cases you can think of where we might disable
> exceptions or do something odd where it would not be okay to remove a
> check for a nullptr?

I've added a cset to https://savannah.gnu.org/bugs/?55347 which removes
almost all detected V668 cases except two, see cset description.

-- Andy