Skip to content

os: resolve unused variable warning#65714

Merged
SrinivasaBharath merged 1 commit intoceph:mainfrom
batrick:objstore-warning
Oct 27, 2025
Merged

os: resolve unused variable warning#65714
SrinivasaBharath merged 1 commit intoceph:mainfrom
batrick:objstore-warning

Conversation

@batrick
Copy link
Member

@batrick batrick commented Sep 29, 2025

Found by Windows tests:

[305/1061] /home/ubuntu/ceph/build.deps/mingw-llvm/bin/x86_64-w64-mingw32-clang++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_NO_TS_EXECUTORS -DFMT_HEADER_ONLY=1 -DFMT_USE_TZSET=0 -DHAVE_CONFIG_H -DWITH_KSTORE -D_FILE_OFFSET_BITS=64 -D_POSIX=1 -D_POSIX_=1 -D_POSIX_C_SOURCE=1 -D_POSIX_THREADS=1 -D_REENTRANT -D_THREAD_SAFE -D_WIN32_WINNT=0x0A00 -D__CEPH__ -D__STDC_FORMAT_MACROS -I/home/ubuntu/ceph/build/src/include -I/home/ubuntu/ceph/src -I/home/ubuntu/ceph/src/include/win32 -isystem /home/ubuntu/ceph/build.deps/mingw/boost/include -isystem /home/ubuntu/ceph/build/include -isystem /home/ubuntu/ceph/src/xxHash -isystem /home/ubuntu/ceph/src/fmt/include -isystem /home/ubuntu/ceph/src/rocksdb/include -isystem /home/ubuntu/ceph/build.deps/mingw/snappy/include -isystem /home/ubuntu/ceph/build.deps/mingw/lz4/lib -isystem /home/ubuntu/ceph/build.deps/mingw/zlib/include -g1 -O3 -DNDEBUG   -I/home/ubuntu/ceph/build.deps/mingw-llvm/x86_64-w64-mingw32/include -I/home/ubuntu/ceph/build.deps/mingw-llvm/x86_64-w64-mingw32/include -march=native -Wno-unknown-attributes -include winsock_wrapper.h -include win32_errno.h -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -Wsign-compare -ftemplate-depth-1024 -DBOOST_ALLOW_DEPRECATED_HEADERS -Wpessimizing-move -Wredundant-move -Wno-inconsistent-missing-override -Wno-mismatched-tags -Wno-unused-private-field -Wno-address-of-packed-member -Wno-unused-function -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register -fdiagnostics-color=auto -std=c++2b -MD -MT src/os/CMakeFiles/os.dir/ObjectStore.cc.obj -MF src/os/CMakeFiles/os.dir/ObjectStore.cc.obj.d -o src/os/CMakeFiles/os.dir/ObjectStore.cc.obj -c /home/ubuntu/ceph/src/os/ObjectStore.cc
/home/ubuntu/ceph/src/os/ObjectStore.cc:72:7: warning: unused variable 'r' [-Wunused-variable]
  int r;
      ^
1 warning generated.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@batrick batrick requested a review from a team as a code owner September 29, 2025 12:40
@github-actions github-actions bot added the core label Sep 29, 2025
Copy link
Contributor

@ronen-fr ronen-fr left a comment

Choose a reason for hiding this comment

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

Seems that the '#else' is incorrect

#endif

#else
return -EINVAL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Which line returns the result, if WITH_BLUESTORE is set, and get_block..() returns non zero?

Copy link
Member Author

Choose a reason for hiding this comment

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

Quite right, fixed!

Copy link
Contributor

@ronen-fr ronen-fr Sep 29, 2025

Choose a reason for hiding this comment

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

LGTM (also possible to maintain the #endif:
#if blue
int r = ...
if (r != 0) {
return r;
}
#endif
return -EINVAL
)

Found by Windows tests:

    [305/1061] /home/ubuntu/ceph/build.deps/mingw-llvm/bin/x86_64-w64-mingw32-clang++ -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_NO_TS_EXECUTORS -DFMT_HEADER_ONLY=1 -DFMT_USE_TZSET=0 -DHAVE_CONFIG_H -DWITH_KSTORE -D_FILE_OFFSET_BITS=64 -D_POSIX=1 -D_POSIX_=1 -D_POSIX_C_SOURCE=1 -D_POSIX_THREADS=1 -D_REENTRANT -D_THREAD_SAFE -D_WIN32_WINNT=0x0A00 -D__CEPH__ -D__STDC_FORMAT_MACROS -I/home/ubuntu/ceph/build/src/include -I/home/ubuntu/ceph/src -I/home/ubuntu/ceph/src/include/win32 -isystem /home/ubuntu/ceph/build.deps/mingw/boost/include -isystem /home/ubuntu/ceph/build/include -isystem /home/ubuntu/ceph/src/xxHash -isystem /home/ubuntu/ceph/src/fmt/include -isystem /home/ubuntu/ceph/src/rocksdb/include -isystem /home/ubuntu/ceph/build.deps/mingw/snappy/include -isystem /home/ubuntu/ceph/build.deps/mingw/lz4/lib -isystem /home/ubuntu/ceph/build.deps/mingw/zlib/include -g1 -O3 -DNDEBUG   -I/home/ubuntu/ceph/build.deps/mingw-llvm/x86_64-w64-mingw32/include -I/home/ubuntu/ceph/build.deps/mingw-llvm/x86_64-w64-mingw32/include -march=native -Wno-unknown-attributes -include winsock_wrapper.h -include win32_errno.h -Wall -fno-strict-aliasing -fsigned-char -Wtype-limits -Wignored-qualifiers -Wpointer-arith -Werror=format-security -Winit-self -Wno-unknown-pragmas -Wnon-virtual-dtor -Wno-ignored-qualifiers -Wsign-compare -ftemplate-depth-1024 -DBOOST_ALLOW_DEPRECATED_HEADERS -Wpessimizing-move -Wredundant-move -Wno-inconsistent-missing-override -Wno-mismatched-tags -Wno-unused-private-field -Wno-address-of-packed-member -Wno-unused-function -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register -fdiagnostics-color=auto -std=c++2b -MD -MT src/os/CMakeFiles/os.dir/ObjectStore.cc.obj -MF src/os/CMakeFiles/os.dir/ObjectStore.cc.obj.d -o src/os/CMakeFiles/os.dir/ObjectStore.cc.obj -c /home/ubuntu/ceph/src/os/ObjectStore.cc
    /home/ubuntu/ceph/src/os/ObjectStore.cc:72:7: warning: unused variable 'r' [-Wunused-variable]
      int r;
          ^
    1 warning generated.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
#endif

#else
return -EINVAL;
Copy link
Contributor

@ronen-fr ronen-fr Sep 29, 2025

Choose a reason for hiding this comment

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

LGTM (also possible to maintain the #endif:
#if blue
int r = ...
if (r != 0) {
return r;
}
#endif
return -EINVAL
)

@batrick
Copy link
Member Author

batrick commented Sep 29, 2025

jenkins test make check arm64

1 similar comment
@batrick
Copy link
Member Author

batrick commented Sep 30, 2025

jenkins test make check arm64

@ljflores
Copy link
Member

@SrinivasaBharath SrinivasaBharath merged commit fa31c2e into ceph:main Oct 27, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants