Skip to contentSkip to conversation

Add -Wno-enum-mismatch

PATCH RESEND New Josh Triplett 1 participant 1 message Aug 30, 2006 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 2/3 Add -Wno-enum-mismatch

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.

---
 evaluate.c |    2 ++
 lib.c      |    2 ++
 lib.h      |    1 +
 3 files changed, 5 insertions(+), 0 deletions(-)
evaluate.c +2 -0
index c5d2526..177797a 100644
@@ -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)
lib.c +2 -0
index 61c35b3..8fac8ae 100644
@@ -179,6 +179,7 @@ int Wdecl = 0;
 int Wtransparent_union = 1;
 int Wshadow = 0;
 int Waddress_space = 1;
+int Wenum_mismatch = 1;
 int preprocess_only;
 char *include;
 int include_fd = -1;
@@ -325,6 +326,7 @@ static const struct warning {
 	{ "transparent-union", &Wtransparent_union },
 	{ "shadow", &Wshadow },
 	{ "address-space", &Waddress_space },
+	{ "enum-mismatch", &Wenum_mismatch },
 };
 
 
lib.h +1 -0
index 24dd38f..0b45c67 100644
@@ -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;
 extern int Wshadow;
Signature · 1 line
1.4.1.1