Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Phil Carmody <carmody@cpd.ntc.nokia.com>
To: axp-list@redhat.com
Subject: Re: Fix for asm/system.h
Date: Fri, 30 Apr 1999 12:09:57 +0100	[thread overview]
Message-ID: <199904301109.MAA16730@mvagusta> (raw)
In-Reply-To: <199904292122.XAA37874@vmax.unix-ag.uni-siegen.de> (message from Nils Faerber on Thu, 29 Apr 1999 23:22:42 +0200 (MESZ))

>>>>> "Nils" == Nils Faerber <Nils.Faerber@unix-ag.org> writes:

My view is highly dependent on what system.h actually contains (viz. the
type of ptr), I don't have access to the file at the moment, however, I
would say: 
Never use an explicit cast solely to silence a compiler warning.
The action being preformed by the code remains the same, if it's dangerous
let is be flagged as such.
(And why is code with switch statements in a header file?)

Phil

Nils> Hello!
Nils> While compiling a C++ program I noticed a little nastiness in asm/system.h
Nils> (for Alpha of course). G++ always complained that an implicit cast would not
Nils> be allowed with ANSI C++. OK I thought, then make it explicit ;)
Nils> Here is a little diff... would someone please include this for the next
Nils> kernel release?
Nils> Thanks!
Nils> CU
Nils>   nils

Nils> *** /usr/src/linux-2.2.6/include/asm/system.h	Thu Apr  1 00:00:29 1999
Nils> --- system.h	Thu Apr 29 17:01:37 1999
Nils> ***************
Nils> *** 292,300 ****
Nils>   {
Nils>   	switch (size) {
Nils>   		case 4:
Nils> ! 			return xchg_u32(ptr, x);
Nils>   		case 8:
Nils> ! 			return xchg_u64(ptr, x);
Nils>   	}
Nils>   	__xchg_called_with_bad_pointer();
Nils>   	return x;
Nils> --- 292,300 ----
Nils>   {
Nils>   	switch (size) {
Nils>   		case 4:
Nils> ! 			return xchg_u32((volatile int *)ptr, x);
Nils>   		case 8:
Nils> ! 			return xchg_u64((volatile long *)ptr, x);
Nils>   	}
Nils>   	__xchg_called_with_bad_pointer();
Nils>   	return


  reply	other threads:[~1999-04-30 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-29 21:22 Fix for asm/system.h Nils Faerber
1999-04-30 11:09 ` Phil Carmody [this message]
1999-04-30 16:35   ` Wes Bauske
1999-05-02 20:16 ` Richard Henderson
1999-05-03  2:03   ` Nils Faerber
1999-05-03  6:55     ` Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox