Skip to content

Commit

Permalink
Fix compile failure due to unused private field
Browse files Browse the repository at this point in the history
In CMake release builds, RaidBackupFileSystem::mDiscSet was initialized but
never read, and this was detected by -Werror,-Wunused-private-field.

Now the field is totally compiled out of release builds, and by using the
correct preprocessor define, CMake and the Perl buildsystem now behave the
same.
  • Loading branch information
qris committed Oct 20, 2017
1 parent 0419437 commit 39e624f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/backupstore/BackupFileSystem.cpp
Expand Up @@ -450,15 +450,19 @@ class RaidPutFileCompleteTransaction : public BackupFileSystem::Transaction
private:
RaidFileWrite mStoreFile;
std::string mFileName;
#ifndef BOX_RELEASE_BUILD
int mDiscSet;
#endif
bool mCommitted;

public:
RaidPutFileCompleteTransaction(int StoreDiscSet, const std::string& filename,
BackupStoreRefCountDatabase::refcount_t refcount)
: mStoreFile(StoreDiscSet, filename, refcount),
mFileName(filename),
#ifndef BOX_RELEASE_BUILD
mDiscSet(StoreDiscSet),
#endif
mCommitted(false),
mNumBlocks(-1)
{ }
Expand All @@ -485,7 +489,7 @@ void RaidPutFileCompleteTransaction::Commit()
ASSERT(!mCommitted);
mStoreFile.Commit(BACKUP_STORE_CONVERT_TO_RAID_IMMEDIATELY);

#ifndef NDEBUG
#ifndef BOX_RELEASE_BUILD
// Verify the file -- only necessary for non-diffed versions.
//
// We cannot use VerifyEncodedFileFormat() until the file is committed. We already
Expand All @@ -499,7 +503,7 @@ void RaidPutFileCompleteTransaction::Commit()
"Newly saved file does not verify after write: this should not "
"happen: " << mFileName);
}
#endif // !NDEBUG
#endif // !BOX_RELEASE_BUILD

mCommitted = true;
}
Expand Down

0 comments on commit 39e624f

Please sign in to comment.