Skip to content

Commit

Permalink
migrate from FOLLY_MAYBE_UNUSED to [[maybe_unused]]
Browse files Browse the repository at this point in the history
Reviewed By: ot, Orvid, xinchenguo

Differential Revision: D54089810

fbshipit-source-id: c88eb520404590c9759e0e29966d1399c26a2244
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Feb 28, 2024
1 parent fbd06a5 commit b4311c7
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion eden/fs/inodes/FileInode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ ImmediateFuture<struct stat> FileInode::stat(
}
}

void FileInode::updateBlockCount(FOLLY_MAYBE_UNUSED struct stat& st) {
void FileInode::updateBlockCount([[maybe_unused]] struct stat& st) {
// win32 does not have stat::st_blocks
#ifndef _WIN32
// Compute a value to store in st_blocks based on st_size.
Expand Down
4 changes: 2 additions & 2 deletions eden/fs/inodes/InodeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ InodeBase::InodeBase(EdenMount* mount)
InodeBase::InodeBase(
InodeNumber ino,
mode_t initialMode,
FOLLY_MAYBE_UNUSED const std::optional<InodeTimestamps>& initialTimestamps,
[[maybe_unused]] const std::optional<InodeTimestamps>& initialTimestamps,
TreeInodePtr parent,
PathComponentPiece name)
: ino_{ino},
Expand Down Expand Up @@ -347,7 +347,7 @@ void InodeBase::updateAtime() {
#endif
}

void InodeBase::updateMtimeAndCtime(FOLLY_MAYBE_UNUSED EdenTimestamp now) {
void InodeBase::updateMtimeAndCtime([[maybe_unused]] EdenTimestamp now) {
#ifndef _WIN32
XLOG(DBG9) << "Updating timestamps for : " << ino_;
getMount()->getInodeMetadataTable()->modifyOrThrow(
Expand Down
8 changes: 4 additions & 4 deletions eden/fs/inodes/InodeCatalog.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ class InodeCatalog {
* directory when EdenFS is not running.
*/
virtual InodeNumber scanLocalChanges(
FOLLY_MAYBE_UNUSED std::shared_ptr<const EdenConfig> config,
FOLLY_MAYBE_UNUSED AbsolutePathPiece mountPath,
FOLLY_MAYBE_UNUSED bool windowsSymlinksEnabled,
FOLLY_MAYBE_UNUSED LookupCallback& callback) {
[[maybe_unused]] std::shared_ptr<const EdenConfig> config,
[[maybe_unused]] AbsolutePathPiece mountPath,
[[maybe_unused]] bool windowsSymlinksEnabled,
[[maybe_unused]] LookupCallback& callback) {
EDEN_BUG() << "UNIMPLEMENTED";
}

Expand Down
2 changes: 1 addition & 1 deletion eden/fs/inodes/InodeMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ void InodeMap::setUnmounted() {
}

Future<SerializedInodeMap> InodeMap::shutdown(
FOLLY_MAYBE_UNUSED bool doTakeover) {
[[maybe_unused]] bool doTakeover) {
// Record that we are in the process of shutting down.
auto future = Future<folly::Unit>::makeEmpty();
{
Expand Down
4 changes: 2 additions & 2 deletions eden/fs/inodes/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ folly::SemiFuture<Unit> Overlay::initialize(
void Overlay::initOverlay(
std::shared_ptr<const EdenConfig> config,
std::optional<AbsolutePath> mountPath,
FOLLY_MAYBE_UNUSED const OverlayChecker::ProgressCallback& progressCallback,
FOLLY_MAYBE_UNUSED InodeCatalog::LookupCallback& lookupCallback) {
[[maybe_unused]] const OverlayChecker::ProgressCallback& progressCallback,
[[maybe_unused]] InodeCatalog::LookupCallback& lookupCallback) {
IORequest req{this};
auto optNextInodeNumber =
inodeCatalog_->initOverlay(/*createIfNonExisting=*/true);
Expand Down
4 changes: 2 additions & 2 deletions eden/fs/inodes/TreeInode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ FileInodePtr TreeInode::createImpl(
folly::Synchronized<TreeInodeState>::LockedPtr contents,
PathComponentPiece name,
mode_t mode,
FOLLY_MAYBE_UNUSED ByteRange fileContents,
[[maybe_unused]] ByteRange fileContents,
InvalidationRequired invalidate,
std::chrono::system_clock::time_point startTime) {
#ifndef _WIN32
Expand Down Expand Up @@ -3835,7 +3835,7 @@ bool needDecFsRefcount(InodeMap& inodeMap, InodeNumber ino) {
folly::Try<folly::Unit> TreeInode::invalidateChannelEntryCache(
TreeInodeState&,
PathComponentPiece name,
FOLLY_MAYBE_UNUSED std::optional<InodeNumber> ino) {
[[maybe_unused]] std::optional<InodeNumber> ino) {
auto faultTry = getMount()->getServerState()->getFaultInjector().checkTry(
"invalidateChannelEntryCache", name);
if (faultTry.hasException()) {
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/inodes/lmdbcatalog/LMDBInodeCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ InodeNumber LMDBInodeCatalog::scanLocalChanges(
std::shared_ptr<const EdenConfig> /*config*/,
AbsolutePathPiece /*mountPath*/,
bool /*windowsSymlinksEnabled*/,
FOLLY_MAYBE_UNUSED InodeCatalog::LookupCallback& /*callback*/) {
[[maybe_unused]] InodeCatalog::LookupCallback& /*callback*/) {
NOT_IMPLEMENTED();
}
} // namespace facebook::eden
10 changes: 5 additions & 5 deletions eden/fs/inodes/memcatalog/MemInodeCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ InodeNumber MemInodeCatalog::nextInodeNumber() {
}

std::optional<fsck::InodeInfo> MemInodeCatalog::loadInodeInfo(
FOLLY_MAYBE_UNUSED InodeNumber number) {
[[maybe_unused]] InodeNumber number) {
return std::nullopt;
}

InodeNumber MemInodeCatalog::scanLocalChanges(
FOLLY_MAYBE_UNUSED std::shared_ptr<const EdenConfig> config,
FOLLY_MAYBE_UNUSED AbsolutePathPiece mountPath,
FOLLY_MAYBE_UNUSED bool windowsSymlinksEnabled,
FOLLY_MAYBE_UNUSED InodeCatalog::LookupCallback& callback) {
[[maybe_unused]] std::shared_ptr<const EdenConfig> config,
[[maybe_unused]] AbsolutePathPiece mountPath,
[[maybe_unused]] bool windowsSymlinksEnabled,
[[maybe_unused]] InodeCatalog::LookupCallback& callback) {
#ifdef _WIN32
windowsFsckScanLocalChanges(
config,
Expand Down
4 changes: 2 additions & 2 deletions eden/fs/inodes/sqlitecatalog/SqliteInodeCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ std::vector<InodeNumber> SqliteInodeCatalog::getAllParentInodeNumbers() {
InodeNumber SqliteInodeCatalog::scanLocalChanges(
std::shared_ptr<const EdenConfig> config,
AbsolutePathPiece mountPath,
FOLLY_MAYBE_UNUSED bool windowsSymlinksEnabled,
FOLLY_MAYBE_UNUSED InodeCatalog::LookupCallback& callback) {
[[maybe_unused]] bool windowsSymlinksEnabled,
[[maybe_unused]] InodeCatalog::LookupCallback& callback) {
#ifdef _WIN32
windowsFsckScanLocalChanges(
config,
Expand Down
6 changes: 3 additions & 3 deletions eden/fs/inodes/test/CheckoutTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ inline void PrintTo(

namespace {

bool isExecutable(FOLLY_MAYBE_UNUSED int perms) {
bool isExecutable([[maybe_unused]] int perms) {
#ifndef _WIN32
return perms & S_IXUSR;
#else
Expand Down Expand Up @@ -156,7 +156,7 @@ void loadInodes(
RelativePathPiece path,
LoadBehavior loadType,
std::optional<folly::StringPiece> expectedContents,
FOLLY_MAYBE_UNUSED mode_t expectedPerms) {
[[maybe_unused]] mode_t expectedPerms) {
switch (loadType) {
case LoadBehavior::NONE:
return;
Expand Down Expand Up @@ -390,7 +390,7 @@ void testModifyFile(
}

testMount.getClock().advance(10min);
FOLLY_MAYBE_UNUSED auto checkoutStart = testMount.getClock().getTimePoint();
[[maybe_unused]] auto checkoutStart = testMount.getClock().getTimePoint();
auto executor = testMount.getServerExecutor().get();
auto checkoutResult = testMount.getEdenMount()
->checkout(
Expand Down
8 changes: 4 additions & 4 deletions eden/fs/service/EdenServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1509,8 +1509,8 @@ void EdenServer::unregisterInodePopulationReportsCallback() {
}

Future<Unit> EdenServer::performTakeoverStart(
FOLLY_MAYBE_UNUSED std::shared_ptr<EdenMount> edenMount,
FOLLY_MAYBE_UNUSED TakeoverData::MountInfo&& info) {
[[maybe_unused]] std::shared_ptr<EdenMount> edenMount,
[[maybe_unused]] TakeoverData::MountInfo&& info) {
#ifndef _WIN32
auto mountPath = info.mountPath;

Expand All @@ -1531,8 +1531,8 @@ Future<Unit> EdenServer::performTakeoverStart(
}

Future<Unit> EdenServer::completeTakeoverStart(
FOLLY_MAYBE_UNUSED std::shared_ptr<EdenMount> edenMount,
FOLLY_MAYBE_UNUSED TakeoverData::MountInfo&& info) {
[[maybe_unused]] std::shared_ptr<EdenMount> edenMount,
[[maybe_unused]] TakeoverData::MountInfo&& info) {
if (auto channelData = std::get_if<FuseChannelData>(&info.channelInfo)) {
// Start up the fuse workers.
return folly::makeFutureWith(
Expand Down
24 changes: 12 additions & 12 deletions eden/fs/service/EdenServiceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3161,9 +3161,9 @@ folly::SemiFuture<folly::Unit> EdenServiceHandler::semifuture_prefetchFiles(
}

folly::SemiFuture<struct folly::Unit> EdenServiceHandler::semifuture_chown(
FOLLY_MAYBE_UNUSED std::unique_ptr<std::string> mountPoint,
FOLLY_MAYBE_UNUSED int32_t uid,
FOLLY_MAYBE_UNUSED int32_t gid) {
[[maybe_unused]] std::unique_ptr<std::string> mountPoint,
[[maybe_unused]] int32_t uid,
[[maybe_unused]] int32_t gid) {
#ifndef _WIN32
auto handle = lookupMount(mountPoint);
return handle.getEdenMount().chown(uid, gid).ensure([handle] {}).semi();
Expand Down Expand Up @@ -3765,8 +3765,8 @@ void EdenServiceHandler::debugInodeStatus(
}

void EdenServiceHandler::debugOutstandingFuseCalls(
FOLLY_MAYBE_UNUSED std::vector<FuseCall>& outstandingCalls,
FOLLY_MAYBE_UNUSED std::unique_ptr<std::string> mountPoint) {
[[maybe_unused]] std::vector<FuseCall>& outstandingCalls,
[[maybe_unused]] std::unique_ptr<std::string> mountPoint) {
#ifndef _WIN32
auto helper = INSTRUMENT_THRIFT_CALL(DBG2);

Expand Down Expand Up @@ -3802,8 +3802,8 @@ void EdenServiceHandler::debugOutstandingNfsCalls(
}

void EdenServiceHandler::debugOutstandingPrjfsCalls(
FOLLY_MAYBE_UNUSED std::vector<PrjfsCall>& outstandingCalls,
FOLLY_MAYBE_UNUSED std::unique_ptr<std::string> mountPoint) {
[[maybe_unused]] std::vector<PrjfsCall>& outstandingCalls,
[[maybe_unused]] std::unique_ptr<std::string> mountPoint) {
#ifdef _WIN32
auto helper = INSTRUMENT_THRIFT_CALL(DBG2);

Expand Down Expand Up @@ -4026,9 +4026,9 @@ int64_t EdenServiceHandler::debugDropAllPendingRequests() {
}

int64_t EdenServiceHandler::unloadInodeForPath(
FOLLY_MAYBE_UNUSED unique_ptr<string> mountPoint,
FOLLY_MAYBE_UNUSED std::unique_ptr<std::string> path,
FOLLY_MAYBE_UNUSED std::unique_ptr<TimeSpec> age) {
[[maybe_unused]] unique_ptr<string> mountPoint,
[[maybe_unused]] std::unique_ptr<std::string> path,
[[maybe_unused]] std::unique_ptr<TimeSpec> age) {
#ifndef _WIN32
auto helper = INSTRUMENT_THRIFT_CALL(DBG1, *mountPoint, *path);
auto mountHandle = lookupMount(mountPoint);
Expand Down Expand Up @@ -4237,8 +4237,8 @@ void EdenServiceHandler::flushStatsNow() {

folly::SemiFuture<Unit>
EdenServiceHandler::semifuture_invalidateKernelInodeCache(
FOLLY_MAYBE_UNUSED std::unique_ptr<std::string> mountPoint,
FOLLY_MAYBE_UNUSED std::unique_ptr<std::string> path) {
[[maybe_unused]] std::unique_ptr<std::string> mountPoint,
[[maybe_unused]] std::unique_ptr<std::string> path) {
auto helper = INSTRUMENT_THRIFT_CALL(DBG2, *mountPoint, *path);
auto mountHandle = lookupMount(mountPoint);
#ifndef _WIN32
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/service/StartupLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ DaemonStartupLogger::ChildHandler::~ChildHandler() {

DaemonStartupLogger::ChildHandler DaemonStartupLogger::spawnImpl(
StringPiece logPath,
FOLLY_MAYBE_UNUSED PrivHelper* privHelper,
[[maybe_unused]] PrivHelper* privHelper,
const std::vector<std::string>& argv) {
XDCHECK(!logPath.empty());

Expand Down
4 changes: 2 additions & 2 deletions eden/fs/service/ThriftGetObjectImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ folly::Try<BlobMetadata> transformToTryMetadata(
edenMount->getObjectStore()->renderObjectId(id))};
}

// FOLLY_MAYBE_UNUSED: This specialization is used and nessecary, but clang's
// [[maybe_unused]]: This specialization is used and nessecary, but clang's
// maybe unused thing thinks that the templated transformToTryMetadata above
// will over shadow this specialization. So clang will think this is unused.
// Apparently, clang does not bother trying to instantate a templated thing.
Expand All @@ -112,7 +112,7 @@ folly::Try<BlobMetadata> transformToTryMetadata(
// https://stackoverflow.com/questions/66986718/c-clang-emit-warning-about-unused-template-variable)
// Maybe concepts in C++20 will clear this up, but we aren't there yet.
template <>
FOLLY_MAYBE_UNUSED folly::Try<BlobMetadata> transformToTryMetadata(
[[maybe_unused]] folly::Try<BlobMetadata> transformToTryMetadata(
folly::Try<std::optional<BlobMetadata>> metadata,
std::shared_ptr<EdenMount> edenMount,
ObjectId id);
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/testharness/TestMount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ bool TestMount::hasOverlayDir(InodeNumber ino) const {
return edenMount_->getOverlay()->hasOverlayDir(ino);
}

bool TestMount::hasMetadata(FOLLY_MAYBE_UNUSED InodeNumber ino) const {
bool TestMount::hasMetadata([[maybe_unused]] InodeNumber ino) const {
#ifndef _WIN32
return edenMount_->getInodeMetadataTable()->getOptional(ino).has_value();
#else
Expand Down
2 changes: 1 addition & 1 deletion eden/fs/utils/ProcUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ std::optional<size_t> calculatePrivateBytes() {
#endif
}

ProcessList readProcessIdsForPath(FOLLY_MAYBE_UNUSED const AbsolutePath& path) {
ProcessList readProcessIdsForPath([[maybe_unused]] const AbsolutePath& path) {
ProcessList pids;
#ifdef __APPLE__
// Obtain the number of bytes to allocate for the pids buffer.
Expand Down

0 comments on commit b4311c7

Please sign in to comment.