Add the ability to turn off enum type mismatch warnings using -Wno-enum-mismatch, helpful when attempting to track down a particular class of warnings only without losing them amongst others. Enum type mismatch checking defaults to on, so this does not change the default behavior of sparse. Signed-off-by: Josh Triplett <josh@xxxxxxxxxxxxxxx> --- evaluate.c | 2 ++ lib.c | 2 ++ lib.h | 1 + 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/evaluate.c b/evaluate.c index c5d2526..177797a 100644 --- a/evaluate.c +++ b/evaluate.c @@ -243,6 +243,8 @@ warn_for_different_enum_types (struct po struct symbol *typea, struct symbol *typeb) { + if (!Wenum_mismatch) + return; if (typea->type == SYM_NODE) typea = typea->ctype.base_type; if (typeb->type == SYM_NODE) diff --git a/lib.c b/lib.c index 84d0647..d92418a 100644 --- a/lib.c +++ b/lib.c @@ -178,6 +178,7 @@ int Wcast_to_address_space = 0; int Wdecl = 0; int Wtransparent_union = 1; int Waddress_space = 1; +int Wenum_mismatch = 1; int preprocess_only; char *include; int include_fd = -1; @@ -323,6 +324,7 @@ static const struct warning { { "context", &Wcontext }, { "transparent-union", &Wtransparent_union }, { "address-space", &Waddress_space }, + { "enum-mismatch", &Wenum_mismatch }, }; diff --git a/lib.h b/lib.h index e6b9bfa..5f67a12 100644 --- a/lib.h +++ b/lib.h @@ -79,6 +79,7 @@ extern int Wbitwise, Wtypesign, Wcontext extern int Wtransparent_union; extern int Waddress_space; extern int Wcast_to_address_space; +extern int Wenum_mismatch; extern int Wdecl; extern int Wone_bit_signed_bitfield; - To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html