Skip to content

build: silence -Wextra warnings across the library, tests and examples - #246

Merged
harshavardhana merged 1 commit into
minio:mainfrom
harshavardhana:fix/build-warnings
Aug 11, 2026
Merged

build: silence -Wextra warnings across the library, tests and examples#246
harshavardhana merged 1 commit into
minio:mainfrom
harshavardhana:fix/build-warnings

Conversation

@harshavardhana

@harshavardhana harshavardhana commented Aug 11, 2026

Copy link
Copy Markdown
Member

-Wall -Wextra -Wconversion are unconditional in CMakeLists.txt, and the tree currently emits 15 warnings (7 in the library, 8 in the tests). This clears all of them.

Changes

  • src/client.cc — the four best-effort AbortMultipartUpload(amu_args) cleanup calls on failure paths now discard their [[nodiscard]] Result explicitly with (void), matching existing precedent in http.cc:71 and response.cc:615.
  • tests/tests.cc — same treatment for the 8 client_.RemoveBucket(args) cleanup calls.
  • src/client.cc — the two error-carrying ListObjectsResult / RemoveObjectsResult constructors take [[maybe_unused]] error::Error err.
  • src/baseclient.ccGetErrorResponse's unused resource parameter takes [[maybe_unused]]. The signature is left intact: BaseClient::GetErrorResponse is public and reachable from downstream C glue.

Touched files were run through clang-format.

Verification

Warning counts with -Wall -Wextra -Wconversion, GCC 14.2.0 on Linux/x86_64:

Configuration Warnings
C++17 Release — library + tests + examples 0
C++20 Release (MINIO_CPP_STD=20) — all targets 0
MINIO_CPP_ENABLE_RDMA=ON Release — all targets, incl. src/c_api.cc 0
Debug 0 across 63 translation units (linking not completed locally — out of disk, unrelated to these changes)

Follow-up, not addressed here

[[maybe_unused]] on the two result constructors silences the warning but does not restore the dropped error. 3d21189 removed the lines that carried it:

  • ListObjectsResult: resp_->contents.push_back(Item(std::move(err)))
  • RemoveObjectsResult: resp_.errors.push_back(DeleteError(err))

So ListObjects with an invalid argument is now indistinguishable from an empty bucket. This is not only the validate path — StartPrefetch catches every exception and returns an empty ListObjectsResponse, and Populate sets failed_ = true either way, so a 403 or a network failure looks identical too.

That means a simple GetError() accessor fed only from the validate constructor would be worse than none — it would authoritatively report "no error" for a 403. A real fix needs an error channel out of the prefetch future, which changes the type at client.h:44-45. Left for a separate PR.

Summary by CodeRabbit

  • Chores
    • Improved handling of intentionally unused results and parameters.
    • No user-visible behavior or error-handling changes.

Best-effort AbortMultipartUpload cleanups on failure paths and RemoveBucket
cleanups in tests now discard their nodiscard Result explicitly.

The error-carrying ListObjectsResult/RemoveObjectsResult constructors and
GetErrorResponse's resource parameter are marked maybe_unused; the signatures
stay as-is since BaseClient::GetErrorResponse is public API.

Verified 0 warnings with -Wall -Wextra -Wconversion across C++17, C++20
(MINIO_CPP_STD=20) and MINIO_CPP_ENABLE_RDMA=ON builds.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes make intentionally unused parameters and ignored Result values explicit in client implementation and test cleanup code. Runtime behavior and error handling remain unchanged.

Changes

Compiler warning cleanup

Layer / File(s) Summary
Explicit unused values
src/baseclient.cc, src/client.cc, tests/tests.cc
Unused parameters use [[maybe_unused]]. Ignored multipart-abort and bucket-removal results use explicit (void) casts.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • minio/minio-cpp#242: Modifies the same unused parameters and ignored cleanup results to address build warnings.

Suggested reviewers: jiuker

Poem

A rabbit checks each result with care,
Marks unused values sitting there.
Cleanup hops through every test,
While warnings take a quiet rest.
No behavior changes in the burrow bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: silencing compiler warnings across the library, tests, and examples.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@harshavardhana
harshavardhana merged commit e764b82 into minio:main Aug 11, 2026
12 checks passed
@harshavardhana
harshavardhana deleted the fix/build-warnings branch August 11, 2026 22:21
This was referenced Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant