Skip to content

Reduce Warnings - Miscellaneous GCC and Clang Warnings (CDRIVER-5305) #1543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 26, 2024

Conversation

eramongodb
Copy link
Contributor

@eramongodb eramongodb commented Feb 23, 2024

This PR addresses miscellanous GCC and Clang warnings. Verified by this patch.

Many of these warnings are not normally enabled and have relatively low significance, but imo are worth addressing regardless to improve the quality of the codebase.

Each commit in this PR documents the number of warnings addressed according to GCC 11.4 and Clang 15.0 Of course, the numbers are specific to my machine, environment, and project configuration, but they help describe the scope of impact.

Warnings in bundled library source code (specifically jsonsl) are left as-is.

In total, this PR addresses 21 GCC warnings and 1058 Clang warnings on my machine.

Most changes are fairly straightforward and rather mundane.
However, a few changes deserve greater scrutiny from the rest, just in case:

  • Removal of unreachable BSON_THREAD_RETURN in BSON_THREAD_FUN (insert_docs, p) in test-mongoc-sample-commands.c (double-check: continues to behave as expected?).
  • Removal of UB null pointer arithmetic in bson_md5_process in common-md5.c (double-check: continues to behave as expected?).
  • Removal of unused error parameter in _needs_on_demand_aws_kms in mongoc-crypt.c (double-check: no error handling required?).

@eramongodb eramongodb requested a review from kevinAlbs February 23, 2024 19:23
@eramongodb eramongodb self-assigned this Feb 23, 2024
@eramongodb eramongodb changed the title Reduce Warnings - Miscellaneous GCC and Clang Warnings Reduce Warnings - Miscellaneous GCC and Clang Warnings (CDRIVER-5305) Feb 23, 2024
Copy link
Collaborator

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

Efforts towards warning reduction are much appreciated.

  • Removal of unreachable BSON_THREAD_RETURN in BSON_THREAD_FUN (insert_docs, p) in test-mongoc-sample-commands.c (double-check: continues to behave as expected?).
  • Removal of UB null pointer arithmetic in bson_md5_process in common-md5.c (double-check: continues to behave as expected?).
  • Removal of unused error parameter in _needs_on_demand_aws_kms in mongoc-crypt.c (double-check: no error handling required?).

I double checked. These changes LGTM.

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.

2 participants