[PATCH] disable gcc warnings of sign/unsigned comparison
From: Paul Jackson
Date: Thu Jan 01 2004 - 07:34:12 EST
Andrew,
Please consider applying the following patch.
This patch turns off all gcc warnings on comparing signed with unsigned
numbers, by setting the gcc option -Wno-sign-compare in the top
Makefile.
These warnings state:
warning: comparison between signed and unsigned
This patch is a "personal preference" decision. If you choose to
reject it, I seek no justifications.
I like it, and at least with the version of gcc I happen to be using
(3.3), find it really helps. This version of gcc dumps out many such
complaints otherwise.
And one could make a case that Linus would like this patch, from his
remark of a couple months ago, on a thread with the Subject of:
[PATCH] irda: fix type of struct irda_ias_set.attribute.irda_attrib_string.len
in which Linus wrote:
> That's why I hate the "sign compare" warning of gcc so much - it warns
> about things that you CANNOT sanely write in any other way. That makes
> that particular warning _evil_, since it encourages people to write crap
> code.
But what Linus actually thinks of this, I've no further clues.
The patch was computed against 2.6.0-mm2.
Thank-you for your consideration.
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1536 -> 1.1537
# Makefile 1.441 -> 1.442
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/01/01 pj@xxxxxxx 1.1537
# ignore gcc sign compare warnings
# --------------------------------------------
#
diff -Nru a/Makefile b/Makefile
--- a/Makefile Thu Jan 1 04:13:04 2004
+++ b/Makefile Thu Jan 1 04:13:04 2004
@@ -161,7 +161,7 @@
HOSTCC = gcc
HOSTCXX = g++
-HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS = -Wall -Wstrict-prototypes -Wno-sign-compare -O2 -fomit-frame-pointer
HOSTCXXFLAGS = -O2
# Decide whether to build built-in, modular, or both.
@@ -275,7 +275,7 @@
CPPFLAGS := -D__KERNEL__ -Iinclude \
$(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
-CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
+CFLAGS := -Wall -Wstrict-prototypes -Wno-sign-compare -Wno-trigraphs \
-fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/