All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Jackson <pj@sgi.com>
To: Andrew Morton <akpm@osdl.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] disable gcc warnings of sign/unsigned comparison
Date: Thu, 1 Jan 2004 04:33:33 -0800	[thread overview]
Message-ID: <20040101043333.186a3268.pj@sgi.com> (raw)

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@sgi.com	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@sgi.com> 1.650.933.1373

             reply	other threads:[~2004-01-01 12:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-01 12:33 Paul Jackson [this message]
2004-01-01 17:14 ` [PATCH] disable gcc warnings of sign/unsigned comparison Trond Myklebust
2004-01-01 23:15   ` Paul Jackson
2004-01-01 23:33     ` Andrew Morton
2004-01-02  0:08       ` Tomas Szepe
2004-01-02  3:20       ` Paul Jackson
2004-01-02  0:46     ` Trond Myklebust
2004-01-02  0:59       ` Tomas Szepe
2004-01-02  1:31         ` Paul Jackson
2004-01-02  3:05       ` Paul Jackson
     [not found] <19ahq-7Rg-11@gated-at.bofh.it>
     [not found] ` <19eEs-5lC-15@gated-at.bofh.it>
     [not found]   ` <19kgS-4HT-19@gated-at.bofh.it>
2004-01-02  1:33     ` Andi Kleen
2004-01-02  3:07       ` Paul Jackson
2004-01-05  1:41       ` Adrian Bunk
2004-01-05 13:16         ` Paul Jackson
2004-03-29 15:44         ` Paul Jackson
2004-03-29 15:43       ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040101043333.186a3268.pj@sgi.com \
    --to=pj@sgi.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.