Date: Tue, 7 Nov 2000 12:56:39 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Peter Pentchev <roam@orbitel.bg> Cc: hackers@FreeBSD.ORG Subject: Re: umask(2) and -Wconversion Message-ID: <20001107125639.A47446@gray.westgate.gr> In-Reply-To: <20001107121734.D314@ringworld.oblivion.bg>; from roam@orbitel.bg on Tue, Nov 07, 2000 at 12:17:34PM %2B0200 References: <20001107120511.A98074@gray.westgate.gr> <20001107121734.D314@ringworld.oblivion.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <stdio.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001107125639.A47446>