Skip to content
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

MONGOCRYPT-783 address miscellaneous warnings #975

Merged
merged 7 commits into from
Feb 28, 2025

Conversation

eramongodb
Copy link
Contributor

Related to MONGOCRYPT-783.

Addresses miscellaneous warnings which do not have any particular common theme. These are all Clang warnings:

  • -Wold-style-cast: 213 unique, 231 total.
  • -Wmissing-prototypes: 116 unique, 155 total.
  • -Wstrict-prototypes: 24 unique, 618 total.
  • -Wundef: 20 unique, 321 total.
  • -Wmissing-variable-declarations: 20 unique, 32 total.
  • -Wassign-enum: 10 unique, 10 total.
  • -Wunused-macros: 7 unique, 12 total.
  • -Wunreachable-code-break: 3 unique, 5 total.
  • -Wunreachable-code-return: 1 unique, 4 total.
  • -Wvla: 1 unique, 1 total.

-Wold-style-cast warnings are generated when compiling .cpp components for C++ compatibility and testing purposes. Since the cast <-> compound literal equivalence is deliberate, these warnings are simply ignored.


Both -Wmissing-prototype and -Wmissing-variable-declarations help inform when a given function or variable may be declared static or if the header providing the declaration has not been included as it should be. All such symbols (which may be declared static) and components (missing an include directive) have been updated accordingly. Functions and variables which are deliberately not forward-declared in a header are denoted by a preceeding declaration labeled with // -Wmissing-prototypes: <reason>.


-Wundef warnings are addressed for external macros (i.e. _WIN32) by using #ifdef and defined, or by guarding their use with a definition check. For our own macros (e.g. MONGOCRYPT_HAVE_DECIMAL128_SUPPORT), the suggestion in mongodb/mongo-cxx-driver#1333 (comment) is applied to catch cases where the required header providing said macro definition may not be included as it should. This revealed a missing include directive in mc-fle2-payload-iev-v2.c which impacts the behavior of is_fle2_range_indexed_supported_type().

@eramongodb eramongodb requested a review from kevinAlbs February 28, 2025 18:46
@eramongodb eramongodb self-assigned this Feb 28, 2025
@kevinAlbs kevinAlbs requested review from vector-of-bool and removed request for kevinAlbs February 28, 2025 18:53
Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -6,7 +6,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*

Copy link
Contributor

Choose a reason for hiding this comment

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

lost star

Suggested change
*

@eramongodb eramongodb merged commit fd8eef3 into mongodb:master Feb 28, 2025
47 of 49 checks passed
@eramongodb eramongodb deleted the crypt-783-misc branch February 28, 2025 19:59
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