MONGOCRYPT-783 address miscellaneous warnings #975
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 declaredstatic
or if the header providing the declaration has not been included as it should be. All such symbols (which may be declaredstatic
) 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
anddefined
, 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 inmc-fle2-payload-iev-v2.c
which impacts the behavior ofis_fle2_range_indexed_supported_type()
.