Skip to content

Commit

Permalink
replace maybe_unused
Browse files Browse the repository at this point in the history
Summary:
Genna spotted a couple of these in  D61724164. `unused_parameter` is a custom
Watchman macro for unused parameters. Now there is maybe_unused and that is
more standard so let's swap these out.

Reviewed By: jdelliot

Differential Revision: D62314836

fbshipit-source-id: ff10c155b4277716a0ef1893a149dbddc68765f9
  • Loading branch information
Katie Mancini authored and facebook-github-bot committed Sep 11, 2024
1 parent 332614f commit 4c105c3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
7 changes: 2 additions & 5 deletions watchman/fs/FSDetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ using namespace watchman;

namespace watchman {

CaseSensitivity getCaseSensitivityForPath(const char* path) {
CaseSensitivity getCaseSensitivityForPath([[maybe_unused]] const char* path) {
#ifdef __APPLE__
return pathconf(path, _PC_CASE_SENSITIVE) ? CaseSensitivity::CaseSensitive
: CaseSensitivity::CaseInSensitive;
#elif defined(_WIN32)
unused_parameter(path);
return CaseSensitivity::CaseInSensitive;
#else
unused_parameter(path);
return CaseSensitivity::CaseSensitive;
#endif
}
Expand Down Expand Up @@ -122,7 +120,7 @@ w_string w_fstype_detect_macos_nfs(w_string fstype, w_string edenfs_indicator) {
// need to have a fully comprehensive mapping of the underlying filesystem
// type codes to names, just the known problematic types

w_string w_fstype(const char* path) {
w_string w_fstype([[maybe_unused]] const char* path) {
#ifdef __linux__
// If possible, we prefer to read the filesystem type names from
// `/proc/self/mounts`
Expand Down Expand Up @@ -213,7 +211,6 @@ w_string w_fstype(const char* path) {
}
return w_string("unknown", W_STRING_UNICODE);
#else
unused_parameter(path);
return w_string("unknown", W_STRING_UNICODE);
#endif
}
Expand Down
9 changes: 3 additions & 6 deletions watchman/saved_state/SavedStateFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ std::unique_ptr<SavedStateInterface> getInterface(
w_string_piece storageType,
const json_ref& savedStateConfig,
const SCM* scm,
Configuration config,
std::function<void(RootMetadata&)> collectRootMetadata,
ClientContext clientInfo) {
unused_parameter(config);
unused_parameter(collectRootMetadata);
unused_parameter(clientInfo);
[[maybe_unused]] Configuration config,
[[maybe_unused]] std::function<void(RootMetadata&)> collectRootMetadata,
[[maybe_unused]] ClientContext clientInfo) {
#if HAVE_MANIFOLD
if (storageType == "manifold") {
return std::make_unique<ManifoldSavedStateInterface>(
Expand Down
3 changes: 0 additions & 3 deletions watchman/watchman_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ char* realpath(const char* filename, char* target);
#define ignore_result(x) x
#endif

// self-documenting hint to the compiler that we didn't use it
#define unused_parameter(x) (void)x

#ifdef __cplusplus
extern "C" {
#endif
Expand Down

0 comments on commit 4c105c3

Please sign in to comment.