Skip to content

Commit

Permalink
Remove unused-variable in fbandroid/libraries/fbjni/cxx/lyra/lyra.cpp +3
Browse files Browse the repository at this point in the history
Summary:
LLVM-15 has a warning `-Wunused-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance.

This diff either (a) removes an unused variable and, possibly, it's associated code or (b) qualifies the variable with `[[maybe_unused]]`.

#buildsonlynotests - Builds are sufficient

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Reviewed By: palmje

Differential Revision: D65755208

fbshipit-source-id: fca2b88ad04c554dca061d387e0eee40eae7f05e
  • Loading branch information
r-barnes authored and facebook-github-bot committed Nov 13, 2024
1 parent 3ef72a0 commit 5d9e22f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cxx/fbjni/detail/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ logassert(const char* tag, const char* msg, ARGS... args) noexcept {
} while (0)
#endif

#define FBJNI_LOG_ONLY

} // namespace log_
} // namespace jni
} // namespace facebook
Expand All @@ -83,4 +85,5 @@ logassert(const char* tag, const char* msg, ARGS... args) noexcept {
#define FBJNI_LOGE(...) ((void)0)
#define FBJNI_LOGF(...) (abort())
#define FBJNI_ASSERT(cond) ((void)0)
#define FBJNI_LOG_ONLY [[maybe_unused]]
#endif
2 changes: 1 addition & 1 deletion cxx/lyra/lyra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ostream& operator<<(ostream& out, const vector<StackTraceElement>& trace) {
}

void logStackTrace(const vector<StackTraceElement>& trace) {
auto i = 0;
FBJNI_LOG_ONLY int32_t i = 0;
FBJNI_LOGE("Backtrace:");
for (auto& elm : trace) {
if (!elm.functionName().empty()) {
Expand Down

0 comments on commit 5d9e22f

Please sign in to comment.