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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 61c35b3..8fac8ae 100644
--- a/lib.c
+++ b/lib.c
@@ -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 },
 };
 

diff --git a/lib.h b/lib.h
index 24dd38f..0b45c67 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;
 extern int Wshadow;
-- 
1.4.1.1


-
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

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux