From owner-freebsd-hackers Tue Nov 7 2:57:25 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from gray.westgate.gr (gray.westgate.gr [212.205.119.66]) by hub.freebsd.org (Postfix) with ESMTP id A897F37B4C5 for ; Tue, 7 Nov 2000 02:57:21 -0800 (PST) Received: (from charon@localhost) by gray.westgate.gr (8.11.1/8.11.1) id eA7AueA47506; Tue, 7 Nov 2000 12:56:40 +0200 (EET) Date: Tue, 7 Nov 2000 12:56:39 +0200 From: Giorgos Keramidas To: Peter Pentchev Cc: hackers@FreeBSD.ORG Subject: Re: umask(2) and -Wconversion Message-ID: <20001107125639.A47446@gray.westgate.gr> References: <20001107120511.A98074@gray.westgate.gr> <20001107121734.D314@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20001107121734.D314@ringworld.oblivion.bg>; from roam@orbitel.bg on Tue, Nov 07, 2000 at 12:17:34PM +0200 X-PGP-Fingerprint: 3A 75 52 EB F1 58 56 0D - C5 B8 21 B6 1B 5E 4A C2 X-URL: http://students.ceid.upatras.gr/~keramida/index.html Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Nov 07, 2000 at 12:17:34PM +0200, Peter Pentchev wrote: > In my experience, the problem is not only with umask(2) - GCC *is* > a bit stubborn about -Wconversion; I wonder if this is really a GCC bug :( > > I'm having the same problems with many other functions when passing > integer constants - even if I explicitly cast them to a long or unsigned > long or plain unsigned int or whatever the particular function needs, > GCC seems to ignore the cast and whines about the conversion nonetheless :( > > Can anybody else confirm this? I can't dig out a code snippet right now, > but ISTR a recurring case of this when compiling with BDECFLAGS a program > which includes ncurses.h, then passes integer constants to init_pair() > or something similar. Yes, that is what I was trying to do. I wanted to buildworld with BDECFLAGS in a 4.2-BETA installation and libskey among other things just bombed when compiling. I tracked the problem to -Wconversion being too strict about the arguments passed to umask, but this seems to be a GCC problem not a problem with umask() :/// I tried compiling the following little program with -Wconversion and it causes the same warning: 1 #include 2 3 int func (short x); 4 5 int main (void) 6 { 7 int var = 10; 8 9 func((short) var); 10 return 0; 11 } 12 13 int func (short var) 14 { 15 printf("var: %d\n", var); 16 return 0; 17 } The cast to (short) in line 9 does not inhibit the warning when the -Wconversion option of gcc is used as shown below: gray% gcc -Wconversion test2.c test2.c: In function `main': test2.c:9: warning: passing arg 1 of `func' with different width due to prototype I think that I will remove -Wconversion from my BDECFLAGS and move on with compiling my world. On a side-note, the -ansi and -pedantic flags also caused a few problems, and I deleted them from my BDECFLAGS last night. Moving on with my quest to remove as many warnings from /usr/src as possible... - giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message