Skip to content

Assert that cache load is a success#2756

Merged
hevrard merged 1 commit intogoogle:masterfrom
hevrard:fix-unread-variable
May 17, 2019
Merged

Assert that cache load is a success#2756
hevrard merged 1 commit intogoogle:masterfrom
hevrard:fix-unread-variable

Conversation

@hevrard
Copy link
Contributor

@hevrard hevrard commented May 16, 2019

mCache->loadCache() should always succeed given that
mCache->hasCache() had just returned true.

Fix #2729

@hevrard hevrard requested a review from AWoloszyn May 16, 2019 14:14
mCache->loadCache() should always succeed given that
mCache->hasCache() had just returned true.
@hevrard hevrard force-pushed the fix-unread-variable branch from 14ff78d to dd78424 Compare May 16, 2019 14:17
const auto& r = resources[i];
// Check cache first
if (mCache->hasCache(r)) {
succeeded &= mCache->loadCache(r, static_cast<void*>(dst));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no check on "succeeded" at the end? Strange.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was because
if (mCache->hasCache(r)) == true implies mCache->loadCache(r, static_cast<void*>(dst)); == true

And we have no other option if we cant actually load from the cache anyway (if it is in there), so asserting is likely the way to go.

@hevrard hevrard merged commit 36df861 into google:master May 17, 2019
bjoeris pushed a commit to bjoeris/gapid that referenced this pull request May 17, 2019
bjoeris pushed a commit to bjoeris/gapid that referenced this pull request May 17, 2019
bjoeris added a commit to bjoeris/gapid that referenced this pull request May 17, 2019
@hevrard hevrard deleted the fix-unread-variable branch June 21, 2019 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variable is only written into, never read

4 participants