From owner-freebsd-hackers Tue Nov 7 8:19: 0 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 2845837B479 for ; Tue, 7 Nov 2000 08:18:55 -0800 (PST) Received: (from charon@localhost) by gray.westgate.gr (8.11.1/8.11.1) id eA7GHvI49458; Tue, 7 Nov 2000 18:17:57 +0200 (EET) Date: Tue, 7 Nov 2000 18:17:57 +0200 From: Giorgos Keramidas To: andrew@ugh.net.au Cc: hackers@freebsd.org Subject: Re: umask(2) and -Wconversion Message-ID: <20001107181757.A49354@gray.westgate.gr> References: <20001107120511.A98074@gray.westgate.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from andrew@ugh.net.au on Tue, Nov 07, 2000 at 11:30:05PM +1000 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 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