Open Bug 1217308 Opened 5 years ago Updated 2 years ago

Static analysis incorrectly reports "Unused value of must-use type"

Categories

(Firefox Build System :: Source Code Analysis, defect)

defect
Not set

Tracking

(firefox44 affected)

Tracking Status
firefox44 --- affected

People

(Reporter: xidorn, Unassigned)

References

Details

See this error: https://treeherder.mozilla.org/logviewer.html#?job_id=12848952&repo=try

It reports:
>  netwerk/base/TLSServerSocket.cpp:337:5: error: Unused value of must-use type 'already_AddRefed<nsITLSServerSecurityObserver>'
>      observer = mSecurityObserver.forget();
>      ^

The corresponding code is:
> 328: TLSServerConnectionInfo::~TLSServerConnectionInfo()
> 329: {
> 330:   if (!mSecurityObserver) {
> 331:     return;
> 332:   }
> 333: 
> 334:   already_AddRefed<nsITLSServerSecurityObserver> observer;
> 335:   {
> 336:     MutexAutoLock lock(mLock);
> 337:     observer = mSecurityObserver.forget();
> 338:   }
> 339: 
> 340:   NS_ReleaseOnMainThread(Move(observer));
> 341: }

Obviously, `observer` is used in line 340, but it is incorrectly reported to be unused.
Blocks: 1210749
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.