-
Notifications
You must be signed in to change notification settings - Fork 94
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 C99 standard conformance warnings #973
Conversation
@@ -66,7 +63,7 @@ void mc_FLE2EncryptionPlaceholder_init(mc_FLE2EncryptionPlaceholder_t *placehold | |||
memset(placeholder, 0, sizeof(mc_FLE2EncryptionPlaceholder_t)); | |||
} | |||
|
|||
#define ERROR_PREFIX "Error parsing FLE2EncryptionPlaceholder" | |||
#define ERROR_PREFIX "Error parsing FLE2EncryptionPlaceholder: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the extra ": " is missing from all of the ERROR_PREFIX except for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor issue, looks like the extra ": "
made it into mc-rangeopts.c
but not mc-fle2-encryption-placeholder.c
. Everything else looks good!
Related to MONGOCRYPT-783.
Addresses the following C standard conformance warnings for libmongocrypt:
-Wgnu-zero-variadic-macro-arguments
: 13 unique, 2,741 total.-Wnewline-eof
: 41 unique, 803 total.-Wpedantic
for object <-> function pointer conversion: 13 unique, 27 total.-Wextra-semi
: 1 unique, 1 total.-Wpedantic
for__FUNCTION__
: 27 unique, 19,974 total.-Wpedantic
for object <-> function pointer conversions: 3 unique, 29 total.-Wpedantic
for stray semicolon outside a function: 1 unique, 1 total.Remaining
-Wpedantic
warnings concerning anonymous structs and unions are addressed by #972.Most object <-> function pointer conversion warnings are concerned with specifying symbols which are loaded dynamically, as underlying functions require use of
void*
even for function symbols. Themcr_dll_sym
function was split into an*_obj
and*_fn
variant accordingly so that the object -> function pointer cast can be isolated tomcr_dll_sym_fn
. Other instances of such casts are converted into instances of-Wcast-strict-function-type
Clang warnings (-Wpedantic
for GCC) which are silenced using the newMC_(BEGIN|END)_CAST_FUNCTION_TYPE_STRICT_IGNORE
macros.-Wgnu-zero-variadic-macro-arguments
Clang warnings were introduced by #759. Most are easily addressed by deferring the enforcement of a format string argument to the underlying function being invoked (e.g._mongocrypt_set_error
).TheReverted due to overlooking compiler compatibility for this warning flag.-Wvariadic-macro-arguments-omitted
warning is added toENABLE_MORE_WARNINGS_AS_ERRORS
to further enforce at-least-one-argument-to-...
standard conformance.The
CLIENT_ERR_PREFIXED
macro inmc-rangeopts.c
required the most effort to address-Wgnu-zero-variadic-macro-arguments
warnings. TheCLIENT_ERR_PREFIXED
(which is impossible to implement in a conforming manner) was instead replaced with a direct call toCLIENT_ERR
with an explicit prefix of theERROR_PREFIX
macro before the error message strings.