Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: blauzahn on December 19, 2021, 08:06:05 pm

Title: scan-build of trunk found e.g. potentially dereferencing null, patch attached
Post by: blauzahn on December 19, 2021, 08:06:05 pm
Occasionally, I do a (clang) scan-build of cb's trunk with its default set of static analyzer checks. The resulting report (as of now svn 12566), lists numerous potential issues. Unfortunately, these have been accumulated over a long time. I looked into 2 of those and provide small patches for them.

OS: arch linux; wxwidgets (3.1.6): trunk; g++ 11.1.0; clang 13.0.0

Btw: Is there any reason to keep NULL instead of nullptr in cb's c++ (not c-) code? Since this is very low hanging fruit, are there any objections to successively replace them in chunks within trunk? I'd skip imported 3rd-party code like wxscintilla since it would make diffs to their source noisier.
Title: Re: scan-build of trunk found e.g. potentially dereferencing null, patch attached
Post by: BlueHazzard on December 20, 2021, 01:47:23 pm
The reason is time...

I think patches are better in the bug tracker...
Title: Re: scan-build of trunk found e.g. potentially dereferencing null, patch attached
Post by: Miguel Gimenez on December 20, 2021, 01:59:25 pm
Worse, not only NULL is used but 0L I change them to nullptr whenever I work near any, but I have not searched for them expilcitly.

EDIT: I have just removed almost all 0L from the main project, plugins will follow...
Title: Re: scan-build of trunk found e.g. potentially dereferencing null, patch attached
Post by: Miguel Gimenez on December 20, 2021, 08:59:19 pm
0L changed to nullptr applied in [r12598]
Blauzahn patches applied in [r12599]
Title: Re: scan-build of trunk found e.g. potentially dereferencing null, patch attached
Post by: blauzahn on December 20, 2021, 11:13:16 pm
Thank you.