Closed
Bug 529382
Opened 15 years ago
Closed 4 years ago
Warn when side-effecty-looking expressions are buried in NS_ASSERTION()/NS_ABORT_IF_FALSE() et al.
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: cjones, Unassigned)
References
Details
I just found a stupid bug in some of my code where I wrote
Var importantValue;
NS_ABORT_IF_FALSE(!GetImportValue(&importantValue));
It'd be cool if I could get a warning when I do stupid things like this. There are a couple of complications:
(1) Definition of "side-effecty." Some debug checks, like NS_ASSERT(!!ptr), end up making method calls to smart pointers, which look side-effecty but should be ignored. These would probably need to be special-cased.
(2) SanityCheck()-type methods, e.g. NS_ASSERT(SanityCheck()). Personally I prefer a conditionally-compiled |AssertSanity()|-type method instead, so I would be perfectly happy with a warning for this case. Not sure how prevalent this pattern is though.
Comment 1•15 years ago
|
||
yeah we need a similar check for other macros too. I think what we want is a must_be_pure() marker on code and pure annotations on various methods that are pure enough
Updated•7 years ago
|
Product: Core → Firefox Build System
Comment 2•4 years ago
|
||
Our current static-analysis infra has a check for this.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
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
•