Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2000 18:17:57 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        andrew@ugh.net.au
Cc:        hackers@freebsd.org
Subject:   Re: umask(2) and -Wconversion
Message-ID:  <20001107181757.A49354@gray.westgate.gr>
In-Reply-To: <Pine.BSF.4.21.0011072318330.80082-100000@starbug.ugh.net.au>; from andrew@ugh.net.au on Tue, Nov 07, 2000 at 11:30:05PM %2B1000
References:  <20001107120511.A98074@gray.westgate.gr> <Pine.BSF.4.21.0011072318330.80082-100000@starbug.ugh.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 07, 2000 at 11:30:05PM +1000, andrew@ugh.net.au wrote:
> 
> On Tue, 7 Nov 2000, Giorgos Keramidas wrote:
> 
> > discovered the following funny thing about -Wconversion and umask(2),
> 
> I spent quite a while trying to silence that warning in one of my programs
> the otherday but I decided it was probably harmless and left it.

The warning in itself is rather harmless, since it does not cause
much trouble.  However some parts of a FreeBSD world are compiled
with -Werror, and every warning is considered an error that causes
compilation to abort :>

Anyway, this is getting more and more off-topic, since it's obviously
something caused by GCC's strictness when -Wconversion is used.

> I think the reason that the cast doesn't help (or passing a u_int16_t)
> is that when the 16 bit number gets passed it has to be placed on
> the 32 bit stack which promotes it so you will always end up with a
> demotion when the number is taken from the stack and given to umaks as
> a 16 bit int.

I thought that the cast would help because the size of (mode_t) is known
in compile time, and I expected the compiler to place the result of an
expression like `(mode_t) 0' in a properly sized integer type.  I mean,
one would expect that ((short) 0) would be different than ((int) 0);
isn't the compiler supposed to know the diference, if both types have
sizes that are known at compile time?

Whatever...  I will also remove -Wconversion from my make.conf CFLAGS
and move on.  This is probably discussed with the GCC fellows.  I will
sum up what this thread was all about, and post a mail to their lists
tomorrow.  I'm too tired to write to them right now.

- 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?20001107181757.A49354>