Closed
Bug 1475882
Opened 6 years ago
Closed 6 years ago
Enable more clang-tidy/clang-analyzer checks
Categories
(Developer Infrastructure :: Source Code Analysis, defect, P3)
Developer Infrastructure
Source Code Analysis
Tracking
(firefox-esr52 wontfix, firefox-esr60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 fixed)
People
(Reporter: cpeterson, Assigned: cpeterson)
References
(Blocks 1 open bug)
Details
Attachments
(11 files)
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
(deleted),
text/x-review-board-request
|
andi
:
review+
|
Details |
These checks have few or no warnings in mozilla-central. :D
See https://clang-analyzer.llvm.org/available_checks.html for more info on the following checks:
clang-analyzer-cplusplus.NewDelete
clang-analyzer-cplusplus.NewDeleteLeaks
clang-analyzer-unix.cstring.BadSizeArg
clang-analyzer-unix.cstring.NullArg
clang-analyzer-unix.Malloc
See https://clang.llvm.org/extra/clang-tidy/checks/list.html for more info on the following checks:
bugprone-suspicious-memset-usage
misc-macro-repeated-side-effects
misc-string-constructor
misc-string-integer-assignment
misc-swapped-arguments
misc-unused-alias-decls
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 12•6 years ago
|
||
mozreview-review |
Comment on attachment 8992246 [details]
Bug 1475882 - Enable clang-tidy's clang-analyzer-cplusplus.NewDelete check.
https://reviewboard.mozilla.org/r/257076/#review263968
Thank you!
Attachment #8992246 -
Flags: review?(bpostelnicu) → review+
Comment 13•6 years ago
|
||
I'm gonna run these patches also on automation to make sure nothing boogie is happening: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e87c1e134645010667310e312fed69266994ac17
Comment 14•6 years ago
|
||
mozreview-review |
Comment on attachment 8992246 [details]
Bug 1475882 - Enable clang-tidy's clang-analyzer-cplusplus.NewDelete check.
https://reviewboard.mozilla.org/r/257076/#review263972
::: commit-message-6a320:1
(Diff revision 1)
> +Bug 1475882 - Enable clang-tidy's clang-analyzer-cplusplus.NewDelete check. r?andi
I know I am bikesheding but this isn't a clang-tidy checker but clang-analyzer. :)
(different architecture and upstream)
Updated•6 years ago
|
Summary: Enable more clang-tidy checks → Enable more clang-tidy/clang-analyzer checks
Comment 15•6 years ago
|
||
mozreview-review |
Comment on attachment 8992247 [details]
Bug 1475882 - Enable clang-tidy's clang-analyzer-cplusplus.NewDeleteLeaks check.
https://reviewboard.mozilla.org/r/257078/#review264014
As Sylvestre said earlier this is a clang analyzer checker, even if it's used through clang-tidy interface.
Attachment #8992247 -
Flags: review?(bpostelnicu) → review+
Comment 16•6 years ago
|
||
mozreview-review |
Comment on attachment 8992248 [details]
Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.cstring.BadSizeArg check.
https://reviewboard.mozilla.org/r/257080/#review264036
::: tools/clang-tidy/test/clang-analyzer-unix.cstring.BadSizeArg.cpp:4
(Diff revision 1)
> +// https://clang-analyzer.llvm.org/available_checks.html
> +
> +#include <string.h>
> +
Please see how clang-analyzer-security.insecureAPI.mktemp test is implemented. We don't really want here to include system headers but to declare de signature for each function that we call.
Attachment #8992248 -
Flags: review?(bpostelnicu)
Comment 17•6 years ago
|
||
mozreview-review |
Comment on attachment 8992249 [details]
Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.cstring.NullArg check.
https://reviewboard.mozilla.org/r/257082/#review264048
::: tools/clang-tidy/test/clang-analyzer-unix.cstring.NullArg.cpp:4
(Diff revision 1)
> +// https://clang-analyzer.llvm.org/available_checks.html
> +
> +#include <string.h>
> +
Same comments as per my previous review, you can do something similar to this:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6b15d6904a5f62c9085f5ed9b6b032093f3b5d08&selectedJob=188367458
Ofcourse including stren declaration in structures.h.
Attachment #8992249 -
Flags: review?(bpostelnicu)
Comment 18•6 years ago
|
||
mozreview-review |
Comment on attachment 8992250 [details]
Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.Malloc check.
https://reviewboard.mozilla.org/r/257084/#review264066
::: tools/clang-tidy/test/clang-analyzer-unix.Malloc.cpp:4
(Diff revision 1)
> +// https://clang-analyzer.llvm.org/available_checks.html
> +
> +#include <stdlib.h>
> +
As per previous comments, let's do something like this please: https://treeherder.mozilla.org/#/jobs?repo=try&revision=152544ed0b689e695be95fe75b2f5fafac7ddbba
Attachment #8992250 -
Flags: review?(bpostelnicu)
Comment 19•6 years ago
|
||
mozreview-review |
Comment on attachment 8992251 [details]
Bug 1475882 - clang-tidy: Enable bugprone-suspicious-memset-usage check.
https://reviewboard.mozilla.org/r/257086/#review264068
::: tools/clang-tidy/test/bugprone-suspicious-memset-usage.cpp:4
(Diff revision 1)
> +// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-suspicious-memset-usage.html
> +
> +#include <string.h>
> +
Let's use the official test uit for this checker: https://github.com/llvm-mirror/clang-tools-extra/blob/release_50/test/clang-tidy/bugprone-suspicious-memset-usage.cpp or just declare:
void *memset(void *, int, __SIZE_TYPE__);
Attachment #8992251 -
Flags: review?(bpostelnicu)
Comment 20•6 years ago
|
||
mozreview-review |
Comment on attachment 8992252 [details]
Bug 1475882 - Enable clang-tidy's misc-macro-repeated-side-effects check.
https://reviewboard.mozilla.org/r/257088/#review264072
thank you!
Attachment #8992252 -
Flags: review?(bpostelnicu) → review+
Comment 21•6 years ago
|
||
mozreview-review |
Comment on attachment 8992253 [details]
Bug 1475882 - clang-tidy: Enable misc-string-constructor check.
https://reviewboard.mozilla.org/r/257090/#review264074
::: tools/clang-tidy/test/misc-string-constructor.cpp:4
(Diff revision 1)
> +// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-constructor.html
> +
> +#include <string>
> +
As per previous remarks, let's not include please <string> and let's declare our container, for example:
https://github.com/Microsoft/clang-tools-extra/blob/master/test/clang-tidy/misc-string-constructor.cpp
Attachment #8992253 -
Flags: review?(bpostelnicu)
Comment 22•6 years ago
|
||
mozreview-review |
Comment on attachment 8992254 [details]
Bug 1475882 - clang-tidy: Enable misc-string-integer-assignment check.
https://reviewboard.mozilla.org/r/257092/#review264078
::: tools/clang-tidy/test/misc-string-integer-assignment.cpp:4
(Diff revision 1)
> +// https://clang.llvm.org/extra/clang-tidy/checks/bugprone-string-integer-assignment.html
> +
> +#include <string>
> +
Same applies here regarding the string container, https://github.com/llvm-mirror/clang-tools-extra/blob/release_50/test/clang-tidy/misc-string-integer-assignment.cpp
Attachment #8992254 -
Flags: review?(bpostelnicu)
Comment 23•6 years ago
|
||
mozreview-review |
Comment on attachment 8992255 [details]
Bug 1475882 - Enable clang-tidy's misc-swapped-arguments check.
https://reviewboard.mozilla.org/r/257094/#review264080
Thank you!
Attachment #8992255 -
Flags: review?(bpostelnicu) → review+
Comment 24•6 years ago
|
||
mozreview-review |
Comment on attachment 8992256 [details]
Bug 1475882 - Enable clang-tidy's misc-unused-alias-decls check.
https://reviewboard.mozilla.org/r/257096/#review264082
Attachment #8992256 -
Flags: review?(bpostelnicu) → review+
Assignee | ||
Comment 25•6 years ago
|
||
Thanks! I'll fix the clang-analyzer commit messages and add the function prototypes to structures.h instead of #including system header files.
Keywords: leave-open
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 35•6 years ago
|
||
Here is a green static-analysis autotest with my fixes on Try:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1d54e6995143bf4e4acaae4ef32661a746ede538
Comment 36•6 years ago
|
||
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/138f27a016f6
clang-analyzer: Enable clang-analyzer-cplusplus.NewDelete check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/082c2cd47f1c
clang-analyzer: Enable clang-analyzer-cplusplus.NewDeleteLeaks check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/6a5e540c17f3
clang-tidy: Enable misc-macro-repeated-side-effects check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/191a529a0208
clang-tidy: Enable misc-swapped-arguments check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/13739445a00b
clang-tidy: Enable misc-unused-alias-decls check. r=andi
Comment 37•6 years ago
|
||
mozreview-review |
Comment on attachment 8992254 [details]
Bug 1475882 - clang-tidy: Enable misc-string-integer-assignment check.
https://reviewboard.mozilla.org/r/257092/#review264482
Attachment #8992254 -
Flags: review?(bpostelnicu) → review+
Comment 38•6 years ago
|
||
mozreview-review |
Comment on attachment 8992253 [details]
Bug 1475882 - clang-tidy: Enable misc-string-constructor check.
https://reviewboard.mozilla.org/r/257090/#review264484
Attachment #8992253 -
Flags: review?(bpostelnicu) → review+
Comment 39•6 years ago
|
||
mozreview-review |
Comment on attachment 8992248 [details]
Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.cstring.BadSizeArg check.
https://reviewboard.mozilla.org/r/257080/#review264486
Attachment #8992248 -
Flags: review?(bpostelnicu) → review+
Comment 40•6 years ago
|
||
mozreview-review |
Comment on attachment 8992249 [details]
Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.cstring.NullArg check.
https://reviewboard.mozilla.org/r/257082/#review264488
Attachment #8992249 -
Flags: review?(bpostelnicu) → review+
Comment 41•6 years ago
|
||
mozreview-review |
Comment on attachment 8992250 [details]
Bug 1475882 - clang-analyzer: Enable clang-analyzer-unix.Malloc check.
https://reviewboard.mozilla.org/r/257084/#review264490
Attachment #8992250 -
Flags: review?(bpostelnicu) → review+
Comment 42•6 years ago
|
||
mozreview-review |
Comment on attachment 8992251 [details]
Bug 1475882 - clang-tidy: Enable bugprone-suspicious-memset-usage check.
https://reviewboard.mozilla.org/r/257086/#review264492
Attachment #8992251 -
Flags: review?(bpostelnicu) → review+
Comment 43•6 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #35)
> Here is a green static-analysis autotest with my fixes on Try:
>
> https://treeherder.mozilla.org/#/
> jobs?repo=try&revision=1d54e6995143bf4e4acaae4ef32661a746ede538
Thank you very much for doing this!
Comment 44•6 years ago
|
||
bugherder |
Comment 45•6 years ago
|
||
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/21408667426c
clang-analyzer: Enable clang-analyzer-unix.cstring.BadSizeArg check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/8a9e7ed36126
clang-analyzer: Enable clang-analyzer-unix.cstring.NullArg check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/f6ee4608a559
clang-analyzer: Enable clang-analyzer-unix.Malloc check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/be36725735f0
clang-tidy: Enable bugprone-suspicious-memset-usage check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/ffa7c88ba619
clang-tidy: Enable misc-string-constructor check. r=andi
https://hg.mozilla.org/integration/mozilla-inbound/rev/3a3725565d12
clang-tidy: Enable misc-string-integer-assignment check. r=andi
Comment 46•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/21408667426c
https://hg.mozilla.org/mozilla-central/rev/8a9e7ed36126
https://hg.mozilla.org/mozilla-central/rev/f6ee4608a559
https://hg.mozilla.org/mozilla-central/rev/be36725735f0
https://hg.mozilla.org/mozilla-central/rev/ffa7c88ba619
https://hg.mozilla.org/mozilla-central/rev/3a3725565d12
Assignee | ||
Updated•6 years ago
|
Keywords: leave-open
Updated•6 years ago
|
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•