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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message