From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 18348 invoked from network); 30 Apr 1999 11:40:17 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 30 Apr 1999 11:40:17 -0000 Received: from axl01it.ntc.nokia.com (axl01it.ntc.nokia.com [131.228.118.232]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id HAA30319 for ; Fri, 30 Apr 1999 07:10:07 -0400 Received: from ducati.uk.ntc.nokia.com (ducati.uk.ntc.nokia.com [131.228.132.169]) by axl01it.ntc.nokia.com (8.8.5/8.6.9) with ESMTP id OAA27770 for ; Fri, 30 Apr 1999 14:09:02 +0300 (EET DST) Received: from mvagusta (mvagusta [131.228.132.173]) by ducati.uk.ntc.nokia.com (8.6.9/8.6.9) with ESMTP id MAA02383 for ; Fri, 30 Apr 1999 12:09:58 +0100 From: Phil Carmody Received: (carmody@localhost) by mvagusta (SMI-8.6/8.6.9) id MAA16730; Fri, 30 Apr 1999 12:09:57 +0100 Date: Fri, 30 Apr 1999 12:09:57 +0100 Message-Id: <199904301109.MAA16730@mvagusta> To: axp-list@redhat.com 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)) Subject: Re: Fix for asm/system.h Mime-Version: 1.0 (generated by tm-edit 7.68) Content-Type: text/plain; charset=US-ASCII >>>>> "Nils" == Nils Faerber 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